kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Autotest 0.11.1: KVM test: Fixing shutdown test
@ 2009-09-16 18:47 Lucas Meneghel Rodrigues
  0 siblings, 0 replies; only message in thread
From: Lucas Meneghel Rodrigues @ 2009-09-16 18:47 UTC (permalink / raw)
  To: Autotest mailing list; +Cc: KVM mailing list

Only close session after we are sure the guest is down on shutdown test.
Backport of a fix present on trunk.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
---

Index: 0.11.1/client/tests/kvm/kvm_tests.py
===================================================================
--- 0.11.1/client/tests/kvm/kvm_tests.py	(revision 3662)
+++ 0.11.1/client/tests/kvm/kvm_tests.py	(working copy)
@@ -74,26 +74,29 @@
     if not vm.is_alive():
         raise error.TestError("VM seems to be dead; Test requires a living VM")
 
-    logging.info("Waiting for guest to be up...")
+    try:
+        logging.info("Waiting for guest to be up...")
 
-    session = kvm_utils.wait_for(vm.ssh_login, 240, 0, 2)
-    if not session:
-        raise error.TestFail("Could not log into guest")
+        session = kvm_utils.wait_for(vm.ssh_login, 240, 0, 2)
+        if not session:
+            raise error.TestFail("Could not log into guest")
 
-    logging.info("Logged in")
+        logging.info("Logged in")
 
-    # Send the VM's shutdown command
-    session.sendline(vm.get_params().get("cmd_shutdown"))
-    session.close()
+        # Send the VM's shutdown command
+        session.sendline(vm.get_params().get("cmd_shutdown"))
 
-    logging.info("Shutdown command sent; waiting for guest to go down...")
+        logging.info("Shutdown command sent; waiting for guest to go down...")
 
-    if not kvm_utils.wait_for(vm.is_dead, 240, 0, 1):
-        raise error.TestFail("Guest refuses to go down")
+        if not kvm_utils.wait_for(vm.is_dead, 240, 0, 1):
+            raise error.TestFail("Guest refuses to go down")
 
-    logging.info("Guest is down")
+        logging.info("Guest is down")
 
+    finally:
+        session.close()
 
+
 def run_migration(test, params, env):
     """
     KVM migration test:


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-09-16 18:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-16 18:47 Autotest 0.11.1: KVM test: Fixing shutdown test Lucas Meneghel Rodrigues

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).