From patchwork Fri Jun 18 00:14:22 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Goldish X-Patchwork-Id: 106786 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o5I0Fkm9016080 for ; Fri, 18 Jun 2010 00:15:46 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757672Ab0FRAPB (ORCPT ); Thu, 17 Jun 2010 20:15:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48585 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759882Ab0FRAO4 (ORCPT ); Thu, 17 Jun 2010 20:14:56 -0400 Received: from int-mx04.intmail.prod.int.phx2.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.17]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o5I0EtS7023814 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 17 Jun 2010 20:14:56 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx04.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o5I0EtZj012167; Thu, 17 Jun 2010 20:14:55 -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 o5I0EljL005733; Thu, 17 Jun 2010 20:14:54 -0400 From: Michael Goldish To: autotest@test.kernel.org, kvm@vger.kernel.org Cc: Michael Goldish Subject: [KVM-AUTOTEST PATCH 05/18] KVM test: check for RESET QMP events in the system_reset test Date: Fri, 18 Jun 2010 03:14:22 +0300 Message-Id: <1276820075-31310-5-git-send-email-mgoldish@redhat.com> In-Reply-To: <1276820075-31310-4-git-send-email-mgoldish@redhat.com> References: <1276820075-31310-1-git-send-email-mgoldish@redhat.com> <1276820075-31310-2-git-send-email-mgoldish@redhat.com> <1276820075-31310-3-git-send-email-mgoldish@redhat.com> <1276820075-31310-4-git-send-email-mgoldish@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.17 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Fri, 18 Jun 2010 00:15:47 +0000 (UTC) diff --git a/client/tests/kvm/kvm_test_utils.py b/client/tests/kvm/kvm_test_utils.py index 9fdea87..7358589 100644 --- a/client/tests/kvm/kvm_test_utils.py +++ b/client/tests/kvm/kvm_test_utils.py @@ -80,14 +80,26 @@ def reboot(vm, session, method="shell", sleep_before_reset=10, nic_index=0, if method == "shell": # Send a reboot command to the guest's shell session.sendline(vm.get_params().get("reboot_command")) - logging.info("Reboot command sent. Waiting for guest to go down") + logging.info("Reboot command sent. Waiting for guest to go down...") elif method == "system_reset": # Sleep for a while before sending the command time.sleep(sleep_before_reset) + # Clear the event list of all QMP monitors + monitors = [m for m in vm.monitors if m.protocol == "qmp"] + for m in monitors: + m.clear_events() # Send a system_reset monitor command vm.monitor.cmd("system_reset") logging.info("Monitor command system_reset sent. Waiting for guest to " "go down...") + # Look for RESET QMP events + time.sleep(1) + for m in monitors: + if not m.get_event("RESET"): + raise error.TestFail("RESET QMP event not received after " + "system_reset (monitor '%s')" % m.name) + else: + logging.info("RESET QMP event received") else: logging.error("Unknown reboot method: %s", method)