All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: lmr@redhat.com, autotest@test.kernel.org
Cc: kvm@vger.kernel.org, mst@redhat.com
Subject: [PATCH 3/3] KVM test: Test the file transfer during migartion
Date: Sat, 25 Sep 2010 17:36:56 +0800	[thread overview]
Message-ID: <20100925093656.28158.64041.stgit@dhcp-91-158.nay.redhat.com> (raw)
In-Reply-To: <20100925092836.28158.64788.stgit@dhcp-91-158.nay.redhat.com>

This test just do the file transfer from host to guest during migartion in order
to check whether the nic/block state could be saved and loaded correctly.

Signed-off-by: Jason Wang <jasowang@redhat.com>
---
 .../kvm/tests/migration_with_file_transfer.py      |   59 ++++++++++++++++++++
 client/tests/kvm/tests_base.cfg.sample             |    7 ++
 2 files changed, 66 insertions(+), 0 deletions(-)
 create mode 100644 client/tests/kvm/tests/migration_with_file_transfer.py

diff --git a/client/tests/kvm/tests/migration_with_file_transfer.py b/client/tests/kvm/tests/migration_with_file_transfer.py
new file mode 100644
index 0000000..8a316bf
--- /dev/null
+++ b/client/tests/kvm/tests/migration_with_file_transfer.py
@@ -0,0 +1,59 @@
+import logging, time
+from autotest_lib.client.common_lib import utils, error
+import kvm_subprocess, kvm_test_utils, kvm_utils
+
+
+def run_migration_with_file_transfer(test, params, env):
+    """
+    KVM migration test:
+    1) Get a live VM and clone it.
+    2) Verify that the source VM supports migration.  If it does, proceed with
+            the test.
+    3) Reboot the VM
+    4) Send a migration command to the source VM and wait until it's finished.
+    5) Kill off the source VM.
+    6) Log into the destination VM after the migration is finished.
+
+    @param test: kvm test object.
+    @param params: Dictionary with test parameters.
+    @param env: Dictionary with the test environment.
+    """
+
+    def transfer_test(vm, host_path, guest_path, timeout=120):
+        """
+        vm.copy_files_to does not raise exception, so we need a wrapper
+        in order to make it to be used by BackgroundTest.
+        """
+        if not vm.copy_files_to(host_path, guest_path, timeout=timeout):
+            raise error.TestError("Fail to do the file transfer!")
+
+    vm = kvm_test_utils.get_living_vm(env, params.get("main_vm"))
+    timeout = int(params.get("login_timeout", 360))
+    session = kvm_test_utils.wait_for_login(vm, timeout=timeout)
+
+    mig_timeout = float(params.get("mig_timeout", "3600"))
+    mig_protocol = params.get("migration_protocol", "tcp")
+
+    guest_path = params.get("guest_path", "/tmp")
+    file_size = params.get("file_size", "1000")
+    transfer_timeout = int(params.get("transfer_timeout", "240"))
+    bg = None
+
+    try:
+        utils.run("dd if=/dev/zero of=/tmp/file bs=1M count=%s" % file_size)
+
+        # Transfer file from host to guest
+        bg = kvm_test_utils.BackgroundTest(transfer_test,
+                                           (vm, "/tmp/file", guest_path,
+                                            transfer_timeout))
+        bg.start()
+
+        while bg.is_alive():
+            logging.info("File transfer is not ended, start a round of migration ...")
+            # Migrate the VM
+            dest_vm = kvm_test_utils.migrate(vm, env, mig_timeout, mig_protocol, False)
+            vm = dest_vm
+    finally:
+        if bg: bg.join()
+        session.close()
+        utils.run("rm -rf /tmp/zero")
diff --git a/client/tests/kvm/tests_base.cfg.sample b/client/tests/kvm/tests_base.cfg.sample
index 1565dce..56ea7f7 100644
--- a/client/tests/kvm/tests_base.cfg.sample
+++ b/client/tests/kvm/tests_base.cfg.sample
@@ -155,6 +155,9 @@ variants:
             - with_reboot:
                 iterations = 1
                 type = migration_with_reboot
+            - with_file_transfer:
+                iterations = 1
+                type = migration_with_file_transfer
 
     - boot_savevm: install setup unattended_install.cdrom
         type = boot_savevm
@@ -1278,6 +1281,10 @@ variants:
             migration_bg_command = start ping -t localhost
             migration_bg_check_command = tasklist | find /I "ping.exe"
             migration_bg_kill_command = taskkill /IM ping.exe /F
+        migrate_with_file_transfer:
+            guest_path = C:\
+            rtl8139:
+                file_size = 10
         stress_boot:
             alive_test_cmd = systeminfo
         timedrift:


  parent reply	other threads:[~2010-09-25  9:32 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-25  9:36 [PATCH 0/3] Launch other test during migration Jason Wang
2010-09-25  9:36 ` [PATCH 1/3] KVM Test: Introduce a helper class to run a test in the background Jason Wang
2010-09-25  9:36 ` [PATCH 2/3] KVM test: Test reboot during migration Jason Wang
2010-09-25  9:36 ` Jason Wang [this message]
2010-11-01 15:58   ` [PATCH 3/3] KVM test: Test the file transfer during migartion Michael Goldish
2010-11-02  5:34     ` Jason Wang
2010-11-01 15:45 ` [PATCH 0/3] Launch other test during migration Michael Goldish
2010-11-02  5:34   ` Jason Wang
2010-11-02  8:14     ` Michael Goldish
2010-11-03  2:53       ` Jason Wang
2010-11-03  9:08         ` Michael Goldish
2010-11-26 23:01 [PATCH 1/3] KVM Test: Introduce a helper class to run a test in the background Lucas Meneghel Rodrigues
2010-11-26 23:01 ` [PATCH 3/3] KVM test: Test the file transfer during migartion Lucas Meneghel Rodrigues

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100925093656.28158.64041.stgit@dhcp-91-158.nay.redhat.com \
    --to=jasowang@redhat.com \
    --cc=autotest@test.kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=lmr@redhat.com \
    --cc=mst@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.