From patchwork Sun Aug 9 16:51:31 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Goldish X-Patchwork-Id: 40279 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 n79Gn8rZ002801 for ; Sun, 9 Aug 2009 16:49:09 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752290AbZHIQtD (ORCPT ); Sun, 9 Aug 2009 12:49:03 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752103AbZHIQtC (ORCPT ); Sun, 9 Aug 2009 12:49:02 -0400 Received: from mx2.redhat.com ([66.187.237.31]:45724 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752121AbZHIQtB (ORCPT ); Sun, 9 Aug 2009 12:49:01 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n79Gn2RP025841; Sun, 9 Aug 2009 12:49:02 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n79Gn0fl000514; Sun, 9 Aug 2009 12:49:01 -0400 Received: from localhost.localdomain (dhcp-1-31.tlv.redhat.com [10.35.1.31]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n79GmoCO022741; Sun, 9 Aug 2009 12:48:59 -0400 From: Michael Goldish To: autotest@test.kernel.org, kvm@vger.kernel.org Cc: Michael Goldish Subject: [KVM-AUTOTEST PATCH 6/7] KVM test: shutdown test: do not close session immediately after shutdown command Date: Sun, 9 Aug 2009 19:51:31 +0300 Message-Id: In-Reply-To: References: <1249836692-18292-1-git-send-email-mgoldish@redhat.com> <8ba0c835ecadb68d1f444e7cbb32a01d9c6dca3c.1249835925.git.mgoldish@redhat.com> <0cd078eb6e8fc3331afd332b8551a1d981fa183f.1249835925.git.mgoldish@redhat.com> <348018b0e8c76a25b2f35829b1f376f77fd8d269.1249835925.git.mgoldish@redhat.com> In-Reply-To: References: X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org If the session is closed immediately after a command is sent, the command may not be executed. To overcome this, first wait for the guest to shut down, and then close the session. Signed-off-by: Michael Goldish --- client/tests/kvm/kvm_tests.py | 18 ++++++++++-------- 1 files changed, 10 insertions(+), 8 deletions(-) diff --git a/client/tests/kvm/kvm_tests.py b/client/tests/kvm/kvm_tests.py index d98dbae..9cd01e2 100644 --- a/client/tests/kvm/kvm_tests.py +++ b/client/tests/kvm/kvm_tests.py @@ -80,18 +80,20 @@ def run_shutdown(test, params, env): if not session: raise error.TestFail("Could not log into guest") - logging.info("Logged in") + try: + logging.info("Logged in") - # Send the VM's shutdown command - session.sendline(vm.get_params().get("shutdown_command")) - session.close() + # Send the VM's shutdown command + session.sendline(vm.get_params().get("shutdown_command")) + 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):