[KVM-AUTOTEST PATCH 10/26] KVM test: use VM.reboot() instead of kvm_test_utils.reboot()

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

 



Signed-off-by: Michael Goldish <mgoldish@xxxxxxxxxx>
---
 client/tests/kvm/tests/boot.py                  |   16 +++++-----------
 client/tests/kvm/tests/guest_test.py            |    4 ++--
 client/tests/kvm/tests/iofuzz.py                |    3 +--
 client/tests/kvm/tests/kdump.py                 |    2 +-
 client/tests/kvm/tests/migration_with_reboot.py |    2 +-
 client/tests/kvm/tests/timedrift_with_reboot.py |    2 +-
 client/tests/kvm/tests/virtio_console.py        |    2 +-
 client/tests/kvm/tests/whql_client_install.py   |    4 ++--
 client/tests/kvm/tests/whql_submission.py       |    2 +-
 9 files changed, 15 insertions(+), 22 deletions(-)

diff --git a/client/tests/kvm/tests/boot.py b/client/tests/kvm/tests/boot.py
index 54db1c6..15b78b3 100644
--- a/client/tests/kvm/tests/boot.py
+++ b/client/tests/kvm/tests/boot.py
@@ -20,15 +20,9 @@ def run_boot(test, params, env):
     timeout = float(params.get("login_timeout", 240))
     session = vm.wait_for_login(timeout=timeout)
 
-    try:
-        if not params.get("reboot_method"):
-            return
+    if params.get("reboot_method"):
+        if params["reboot_method"] == "system_reset":
+            time.sleep(int(params.get("sleep_before_reset", 10)))
+        session = vm.reboot(session, params["reboot_method"], 0, timeout)
 
-        # Reboot the VM
-        session = kvm_test_utils.reboot(vm, session,
-                                    params.get("reboot_method"),
-                                    float(params.get("sleep_before_reset", 10)),
-                                    0, timeout)
-
-    finally:
-        session.close()
+    session.close()
diff --git a/client/tests/kvm/tests/guest_test.py b/client/tests/kvm/tests/guest_test.py
index cd902df..3e778e9 100644
--- a/client/tests/kvm/tests/guest_test.py
+++ b/client/tests/kvm/tests/guest_test.py
@@ -28,7 +28,7 @@ def run_guest_test(test, params, env):
 
     if reboot == "yes":
         logging.debug("Rebooting guest before test ...")
-        session = kvm_test_utils.reboot(vm, session, timeout=login_timeout)
+        session = vm.reboot(session, timeout=login_timeout)
 
     try:
         logging.info("Starting script...")
@@ -74,7 +74,7 @@ def run_guest_test(test, params, env):
 
         if reboot == "yes":
             logging.debug("Rebooting guest after test ...")
-            session = kvm_test_utils.reboot(vm, session, timeout=login_timeout)
+            session = vm.reboot(session, timeout=login_timeout)
 
         logging.debug("guest test PASSED.")
     finally:
diff --git a/client/tests/kvm/tests/iofuzz.py b/client/tests/kvm/tests/iofuzz.py
index d995509..ed22814 100644
--- a/client/tests/kvm/tests/iofuzz.py
+++ b/client/tests/kvm/tests/iofuzz.py
@@ -82,8 +82,7 @@ def run_iofuzz(test, params, env):
                         session = vm.wait_for_login(timeout=10)
                     except:
                         logging.debug("Could not re-login, reboot the guest")
-                        session = kvm_test_utils.reboot(vm, session,
-                                                        method = "system_reset")
+                        session = vm.reboot(method="system_reset")
                 else:
                     raise error.TestFail("VM has quit abnormally during %s",
                                          (op, operand))
diff --git a/client/tests/kvm/tests/kdump.py b/client/tests/kvm/tests/kdump.py
index bfcbae1..70217ad 100644
--- a/client/tests/kvm/tests/kdump.py
+++ b/client/tests/kvm/tests/kdump.py
@@ -61,7 +61,7 @@ def run_kdump(test, params, env):
         except:
             logging.info("Crash kernel is not loaded. Trying to load it")
             session.cmd(kernel_param_cmd)
-            session = kvm_test_utils.reboot(vm, session, timeout=timeout)
+            session = vm.reboot(session, timeout=timeout)
 
         logging.info("Enabling kdump service...")
         # the initrd may be rebuilt here so we need to wait a little more
diff --git a/client/tests/kvm/tests/migration_with_reboot.py b/client/tests/kvm/tests/migration_with_reboot.py
index a365239..671f1ef 100644
--- a/client/tests/kvm/tests/migration_with_reboot.py
+++ b/client/tests/kvm/tests/migration_with_reboot.py
@@ -30,7 +30,7 @@ def run_migration_with_reboot(test, params, env):
 
     try:
         # Reboot the VM in the background
-        bg = kvm_utils.Thread(kvm_test_utils.reboot, (vm, session))
+        bg = kvm_utils.Thread(vm.reboot, (session,))
         bg.start()
         try:
             while bg.is_alive():
diff --git a/client/tests/kvm/tests/timedrift_with_reboot.py b/client/tests/kvm/tests/timedrift_with_reboot.py
index 8ec121d..a1ab5f3 100644
--- a/client/tests/kvm/tests/timedrift_with_reboot.py
+++ b/client/tests/kvm/tests/timedrift_with_reboot.py
@@ -47,7 +47,7 @@ def run_timedrift_with_reboot(test, params, env):
             # Run current iteration
             logging.info("Rebooting: iteration %d of %d..." %
                          (i + 1, reboot_iterations))
-            session = kvm_test_utils.reboot(vm, session)
+            session = vm.reboot(session)
             # Get time after current iteration
             (ht1_, gt1_) = kvm_test_utils.get_time(session, time_command,
                                                    time_filter_re, time_format)
diff --git a/client/tests/kvm/tests/virtio_console.py b/client/tests/kvm/tests/virtio_console.py
index d7aaaf6..5f1e20a 100644
--- a/client/tests/kvm/tests/virtio_console.py
+++ b/client/tests/kvm/tests/virtio_console.py
@@ -1156,7 +1156,7 @@ def run_virtio_console(test, params, env):
                 logging.error("Virtio-console driver is irreparably"
                               " blocked. Every comd end with sig KILL."
                               "Try reboot vm for continue in testing.")
-                vm[1] = kvm_test_utils.reboot(vm[0], vm[1], "system_reset")
+                vm[1] = vm[0].reboot(vm[1], "system_reset")
                 init_guest(vm, consoles)
                 (match, data) = _on_guest("virt.clean_port('%s'),1024" %
                                       consoles[0][0].name, vm, 2)
diff --git a/client/tests/kvm/tests/whql_client_install.py b/client/tests/kvm/tests/whql_client_install.py
index 5a2ed4d..1459793 100644
--- a/client/tests/kvm/tests/whql_client_install.py
+++ b/client/tests/kvm/tests/whql_client_install.py
@@ -99,7 +99,7 @@ def run_whql_client_install(test, params, env):
     session.cmd(cmd, timeout=300)
 
     # Reboot
-    session = kvm_test_utils.reboot(vm, session)
+    session = vm.reboot(session)
 
     # Access shared resources on the server machine
     logging.info("Attempting to access remote share on server")
@@ -132,5 +132,5 @@ def run_whql_client_install(test, params, env):
     session.cmd(cmd % ("DefaultPassword", client_password))
 
     # Reboot one more time
-    session = kvm_test_utils.reboot(vm, session)
+    session = vm.reboot(session)
     session.close()
diff --git a/client/tests/kvm/tests/whql_submission.py b/client/tests/kvm/tests/whql_submission.py
index afd613e..6a9407f 100644
--- a/client/tests/kvm/tests/whql_submission.py
+++ b/client/tests/kvm/tests/whql_submission.py
@@ -74,7 +74,7 @@ def run_whql_submission(test, params, env):
         server_session.cmd(cmd, print_func=logging.debug)
 
     # Reboot the client machines
-    sessions = kvm_utils.parallel((kvm_test_utils.reboot, (vm, session))
+    sessions = kvm_utils.parallel((vm.reboot, (session,))
                                   for vm, session in zip(vms, sessions))
 
     # Check the NICs again
-- 
1.7.3.4

--
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