[KVM-AUTOTEST PATCH 04/28] KVM test: migration_with_reboot: use kvm_utils.Thread

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Michael Goldish <mgoldish@xxxxxxxxxx>
---
 client/tests/kvm/tests/migration_with_reboot.py |   19 +++++++------------
 1 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/client/tests/kvm/tests/migration_with_reboot.py b/client/tests/kvm/tests/migration_with_reboot.py
index 5070dbc..af5de64 100644
--- a/client/tests/kvm/tests/migration_with_reboot.py
+++ b/client/tests/kvm/tests/migration_with_reboot.py
@@ -19,7 +19,6 @@ def run_migration_with_reboot(test, params, env):
     @param params: Dictionary with test parameters.
     @param env: Dictionary with the test environment.
     """
-
     def reboot_test(client, session, address, reboot_command, port, username,
                     password, prompt, linesep, log_filename, timeout):
         """
@@ -67,24 +66,20 @@ def run_migration_with_reboot(test, params, env):
     mig_timeout = float(params.get("mig_timeout", "3600"))
     mig_protocol = params.get("migration_protocol", "tcp")
     mig_cancel = bool(params.get("mig_cancel"))
-    bg = None
 
     try:
-        # reboot the VM in background
-        bg = kvm_test_utils.BackgroundTest(reboot_test,
-                                           (client, session, address,
+        # Reboot the VM in the background
+        bg = kvm_utils.Thread(reboot_test, (client, session, address,
                                             reboot_command, port, username,
                                             password, prompt, linesep,
                                             log_filename, timeout))
         bg.start()
 
-        while bg.is_alive():
-            # Migrate the VM
-            dest_vm = kvm_test_utils.migrate(vm, env, mig_timeout, mig_protocol,
-                                             False)
-            vm = dest_vm
+        try:
+            while bg.is_alive():
+                vm = kvm_test_utils.migrate(vm, env, mig_timeout, mig_protocol)
+        finally:
+            bg.join()
 
     finally:
-        if bg:
-            bg.join()
         session.close()
-- 
1.7.3.3

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux