From patchwork Wed Oct 7 17:54:21 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Goldish X-Patchwork-Id: 52322 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 n97I5tBF015201 for ; Wed, 7 Oct 2009 18:05:57 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759793AbZJGR6Y (ORCPT ); Wed, 7 Oct 2009 13:58:24 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1759760AbZJGR6T (ORCPT ); Wed, 7 Oct 2009 13:58:19 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38660 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756728AbZJGR6R (ORCPT ); Wed, 7 Oct 2009 13:58:17 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n97Hvp5c010578; Wed, 7 Oct 2009 13:57:51 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n97HvoVY024771; Wed, 7 Oct 2009 13:57:50 -0400 Received: from localhost.localdomain (dhcp-1-188.tlv.redhat.com [10.35.1.188]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n97Hve89014834; Wed, 7 Oct 2009 13:57:49 -0400 From: Michael Goldish To: autotest@test.kernel.org, kvm@vger.kernel.org Cc: Michael Goldish Subject: [KVM-AUTOTEST PATCH 6/7] KVM test: add option to kill all unresponsive VMs at the end of each test Date: Wed, 7 Oct 2009 19:54:21 +0200 Message-Id: <1254938062-15286-6-git-send-email-mgoldish@redhat.com> In-Reply-To: <1254938062-15286-5-git-send-email-mgoldish@redhat.com> References: <1254938062-15286-1-git-send-email-mgoldish@redhat.com> <1254938062-15286-2-git-send-email-mgoldish@redhat.com> <1254938062-15286-3-git-send-email-mgoldish@redhat.com> <1254938062-15286-4-git-send-email-mgoldish@redhat.com> <1254938062-15286-5-git-send-email-mgoldish@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org diff --git a/client/tests/kvm/kvm_preprocessing.py b/client/tests/kvm/kvm_preprocessing.py index 26f7f8e..e624a42 100644 --- a/client/tests/kvm/kvm_preprocessing.py +++ b/client/tests/kvm/kvm_preprocessing.py @@ -293,6 +293,18 @@ def postprocess(test, params, env): int(params.get("post_command_timeout", "600")), params.get("post_command_noncritical") == "yes") + # Kill all unresponsive VMs + if params.get("kill_unresponsive_vms") == "yes": + logging.debug("'kill_unresponsive_vms' specified; killing all VMs " + "that fail to respond to a remote login request...") + for vm in kvm_utils.env_get_all_vms(env): + if vm.is_alive(): + session = vm.remote_login() + if session: + session.close() + else: + vm.destroy(gracefully=False) + # Kill the tailing threads of all VMs for vm in kvm_utils.env_get_all_vms(env): vm.kill_tail_thread() diff --git a/client/tests/kvm/kvm_tests.cfg.sample b/client/tests/kvm/kvm_tests.cfg.sample index e80b645..c4d8a60 100644 --- a/client/tests/kvm/kvm_tests.cfg.sample +++ b/client/tests/kvm/kvm_tests.cfg.sample @@ -13,6 +13,7 @@ convert_ppm_files_to_png_on_error = yes #keep_ppm_files_on_error = yes kill_vm = no kill_vm_gracefully = yes +kill_unresponsive_vms = yes # Some default VM params qemu_binary = qemu