public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Lucas Meneghel Rodrigues <lmr@redhat.com>
To: Autotest mailing list <autotest@test.kernel.org>
Cc: KVM mailing list <kvm@vger.kernel.org>
Subject: Autotest 0.11.1: KVM test: Fixing shutdown test
Date: Wed, 16 Sep 2009 15:47:56 -0300	[thread overview]
Message-ID: <1253126876.2882.8.camel@localhost.localdomain> (raw)

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:


                 reply	other threads:[~2009-09-16 18:47 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1253126876.2882.8.camel@localhost.localdomain \
    --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