diff mbox

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

Message ID 1294751618-21631-10-git-send-email-mgoldish@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Michael Goldish Jan. 11, 2011, 1:13 p.m. UTC
None
diff mbox

Patch

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