From patchwork Mon Mar 8 17:28:17 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas Meneghel Rodrigues X-Patchwork-Id: 84105 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 o28HSVvH031747 for ; Mon, 8 Mar 2010 17:28:31 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752565Ab0CHR21 (ORCPT ); Mon, 8 Mar 2010 12:28:27 -0500 Received: from mx1.redhat.com ([209.132.183.28]:28533 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754391Ab0CHR2Y (ORCPT ); Mon, 8 Mar 2010 12:28:24 -0500 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 o28HSMaW015252 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 8 Mar 2010 12:28:22 -0500 Received: from localhost.localdomain (vpn-9-79.rdu.redhat.com [10.11.9.79]) by int-mx04.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o28HSKhW024046; Mon, 8 Mar 2010 12:28:21 -0500 From: Lucas Meneghel Rodrigues To: autotest@test.kernel.org Cc: kvm@vger.kernel.org, Lucas Meneghel Rodrigues Subject: [PATCH] KVM test: Exposing boot and reboot timeouts in config files Date: Mon, 8 Mar 2010 14:28:17 -0300 Message-Id: <1268069297-8780-1-git-send-email-lmr@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]); Mon, 08 Mar 2010 17:28:31 +0000 (UTC) diff --git a/client/tests/kvm/kvm_test_utils.py b/client/tests/kvm/kvm_test_utils.py index 7d96d6e..564ff35 100644 --- a/client/tests/kvm/kvm_test_utils.py +++ b/client/tests/kvm/kvm_test_utils.py @@ -53,7 +53,7 @@ def wait_for_login(vm, nic_index=0, timeout=240, start=0, step=2): @param timeout: Time to wait before giving up. @return: A shell session object. """ - logging.info("Trying to log into guest '%s'..." % vm.name) + logging.info("Trying to log into guest '%s', timeout %ds", vm.name, timeout) session = kvm_utils.wait_for(lambda: vm.remote_login(nic_index=nic_index), timeout, start, step) if not session: @@ -80,16 +80,16 @@ 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) # Send a system_reset monitor command vm.send_monitor_cmd("system_reset") - logging.info("system_reset monitor command sent; waiting for guest to " - "go down...") + logging.info("Monitor command system_reset sent. Waiting for guest to " + "go down") else: - logging.error("Unknown reboot method: %s" % method) + logging.error("Unknown reboot method: %s", method) # Wait for the session to become unresponsive and close it if not kvm_utils.wait_for(lambda: not session.is_responsive(timeout=30), @@ -98,7 +98,8 @@ def reboot(vm, session, method="shell", sleep_before_reset=10, nic_index=0, session.close() # Try logging into the guest until timeout expires - logging.info("Guest is down; waiting for it to go up again...") + logging.info("Guest is down. Waiting for it to go up again, timeout %ds", + timeout) session = kvm_utils.wait_for(lambda: vm.remote_login(nic_index=nic_index), timeout, 0, 2) if not session: diff --git a/client/tests/kvm/tests/boot.py b/client/tests/kvm/tests/boot.py index cd1f1d4..9b3f392 100644 --- a/client/tests/kvm/tests/boot.py +++ b/client/tests/kvm/tests/boot.py @@ -16,7 +16,9 @@ def run_boot(test, params, env): @param env: Dictionary with test environment. """ vm = kvm_test_utils.get_living_vm(env, params.get("main_vm")) - session = kvm_test_utils.wait_for_login(vm) + session = kvm_test_utils.wait_for_login(vm, 0, + float(params.get("boot_timeout", 240)), + 0, 2) try: if not params.get("reboot_method"): @@ -24,9 +26,9 @@ def run_boot(test, params, env): # Reboot the VM session = kvm_test_utils.reboot(vm, session, - params.get("reboot_method"), - float(params.get("sleep_before_reset", - 10))) + params.get("reboot_method"), + float(params.get("sleep_before_reset", 10)), + 0, float(params.get("reboot_timeout", 240))) finally: session.close() diff --git a/client/tests/kvm/tests_base.cfg.sample b/client/tests/kvm/tests_base.cfg.sample index 040d0c3..340b0c0 100644 --- a/client/tests/kvm/tests_base.cfg.sample +++ b/client/tests/kvm/tests_base.cfg.sample @@ -75,11 +75,13 @@ variants: type = boot restart_vm = yes kill_vm_on_error = yes + boot_timeout = 240 - reboot: install setup unattended_install type = boot reboot_method = shell kill_vm_on_error = yes + reboot_timeout = 240 - migrate: install setup unattended_install type = migration