public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Lucas Meneghel Rodrigues <lmr@redhat.com>
To: autotest@test.kernel.org
Cc: kvm@vger.kernel.org
Subject: [PATCH 1/2] KVM test: Add the ability to test migration during guest installation
Date: Tue, 11 Jan 2011 03:22:03 -0200	[thread overview]
Message-ID: <1294723324-20757-1-git-send-email-lmr@redhat.com> (raw)

From: Jason Wang <jasowang@redhat.com>

It's helpful to test the installation during migration. So patch just reuse the
unattended installation tests and migrate the vm during the wait loop. The
params of "-initrd", "-kernel" and "-append" were also dropped as they may
break the migration.

Changes from v1:
- Use the new super cool vm.migrate() method

Signed-off-by: Jason Wang <jasowang@redhat.com>
---
 client/tests/kvm/tests/unattended_install.py |   22 ++++++++++++++++++++--
 client/tests/kvm/tests_base.cfg.sample       |    3 +++
 2 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/client/tests/kvm/tests/unattended_install.py b/client/tests/kvm/tests/unattended_install.py
index 9617603..fdb020a 100644
--- a/client/tests/kvm/tests/unattended_install.py
+++ b/client/tests/kvm/tests/unattended_install.py
@@ -1,4 +1,4 @@
-import logging, time, socket
+import logging, time, socket, re
 from autotest_lib.client.common_lib import error
 import kvm_utils, kvm_test_utils
 
@@ -24,6 +24,11 @@ def run_unattended_install(test, params, env):
         post_install_delay = 0
 
     install_timeout = float(params.get("timeout", 3000))
+    migrate_background = params.get("migrate_background") == "yes"
+    if migrate_background:
+        mig_timeout = float(params.get("mig_timeout", "3600"))
+        mig_protocol = params.get("migration_protocol", "tcp")
+
     logging.info("Starting unattended install watch process. "
                  "Timeout set to %ds (%d min)", install_timeout,
                  install_timeout/60)
@@ -46,7 +51,20 @@ def run_unattended_install(test, params, env):
                     break
             except socket.error:
                 pass
-        time.sleep(1)
+
+        if migrate_background:
+            # Drop the params which may break the migration
+            # Better method is to used dnsmasq to do the unattended installation
+            if vm.params.get("initrd"):
+                vm.params["initrd"] = None
+            if vm.params.get("kernel"):
+                vm.params["kernel"] = None
+            if vm.params.get("extra_params"):
+                vm.params["extra_params"] = re.sub("--append '.*'", "",
+                                                   vm.params["extra_params"])
+            vm.migrate(timeout=mig_timeout, protocol=mig_protocol)
+        else:
+            time.sleep(1)
         client.close()
         end_time = time.time()
         time_elapsed = int(end_time - start_time)
diff --git a/client/tests/kvm/tests_base.cfg.sample b/client/tests/kvm/tests_base.cfg.sample
index 6374923..047b0f3 100644
--- a/client/tests/kvm/tests_base.cfg.sample
+++ b/client/tests/kvm/tests_base.cfg.sample
@@ -103,6 +103,9 @@ variants:
         kernel = vmlinuz
         initrd = initrd.img
         nic_mode = tap
+        # uncomment the following line to test the migration in parallel
+        # migrate_with_background = yes
+
         variants:
             # Install guest from cdrom 
             - cdrom:
-- 
1.7.3.4

             reply	other threads:[~2011-01-11  5:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-11  5:22 Lucas Meneghel Rodrigues [this message]
2011-01-11  5:22 ` [PATCH 2/2] KVM test: Run client tests of autotest in parallel with migration Lucas Meneghel Rodrigues
2011-01-11 10:39   ` Michael Goldish

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=1294723324-20757-1-git-send-email-lmr@redhat.com \
    --to=lmr@redhat.com \
    --cc=autotest@test.kernel.org \
    --cc=kvm@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox