From patchwork Wed Sep 16 18:47:56 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas Meneghel Rodrigues X-Patchwork-Id: 48052 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n8GIm2tj010362 for ; Wed, 16 Sep 2009 18:48:02 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754424AbZIPSr5 (ORCPT ); Wed, 16 Sep 2009 14:47:57 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754268AbZIPSr5 (ORCPT ); Wed, 16 Sep 2009 14:47:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51007 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753485AbZIPSr5 (ORCPT ); Wed, 16 Sep 2009 14:47:57 -0400 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n8GIm05Z009572; Wed, 16 Sep 2009 14:48:00 -0400 Received: from [10.11.12.159] (vpn-12-159.rdu.redhat.com [10.11.12.159]) by int-mx03.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n8GIlwIo017692; Wed, 16 Sep 2009 14:47:59 -0400 Subject: Autotest 0.11.1: KVM test: Fixing shutdown test From: Lucas Meneghel Rodrigues To: Autotest mailing list Cc: KVM mailing list Date: Wed, 16 Sep 2009 15:47:56 -0300 Message-Id: <1253126876.2882.8.camel@localhost.localdomain> Mime-Version: 1.0 X-Scanned-By: MIMEDefang 2.67 on 10.5.11.16 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org 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 --- -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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: