From patchwork Tue Jan 11 13:13:22 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Goldish X-Patchwork-Id: 471501 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p0BDDSjf008028 for ; Tue, 11 Jan 2011 13:13:31 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932142Ab1AKNN2 (ORCPT ); Tue, 11 Jan 2011 08:13:28 -0500 Received: from mx1.redhat.com ([209.132.183.28]:6673 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932136Ab1AKNNZ (ORCPT ); Tue, 11 Jan 2011 08:13:25 -0500 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id p0BDDOfv009233 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 11 Jan 2011 08:13:25 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p0BDDO1C013222; Tue, 11 Jan 2011 08:13:24 -0500 Received: from qu0061.eng.lab.tlv.redhat.com ([10.35.16.61]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id p0BDD9nW025030; Tue, 11 Jan 2011 08:13:23 -0500 From: Michael Goldish To: autotest@test.kernel.org, kvm@vger.kernel.org Cc: Michael Goldish Subject: [KVM-AUTOTEST PATCH 10/26] KVM test: use VM.reboot() instead of kvm_test_utils.reboot() Date: Tue, 11 Jan 2011 15:13:22 +0200 Message-Id: <1294751618-21631-10-git-send-email-mgoldish@redhat.com> In-Reply-To: <1294751618-21631-1-git-send-email-mgoldish@redhat.com> References: <1294751618-21631-1-git-send-email-mgoldish@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 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.6 (demeter1.kernel.org [140.211.167.41]); Tue, 11 Jan 2011 13:13:32 +0000 (UTC) diff --git a/client/tests/kvm/tests/boot.py b/client/tests/kvm/tests/boot.py index 54db1c6..15b78b3 100644 --- a/client/tests/kvm/tests/boot.py +++ b/client/tests/kvm/tests/boot.py @@ -20,15 +20,9 @@ def run_boot(test, params, env): timeout = float(params.get("login_timeout", 240)) session = vm.wait_for_login(timeout=timeout) - try: - if not params.get("reboot_method"): - return + if params.get("reboot_method"): + if params["reboot_method"] == "system_reset": + time.sleep(int(params.get("sleep_before_reset", 10))) + session = vm.reboot(session, params["reboot_method"], 0, timeout) - # Reboot the VM - session = kvm_test_utils.reboot(vm, session, - params.get("reboot_method"), - float(params.get("sleep_before_reset", 10)), - 0, timeout) - - finally: - session.close() + session.close() diff --git a/client/tests/kvm/tests/guest_test.py b/client/tests/kvm/tests/guest_test.py index cd902df..3e778e9 100644 --- a/client/tests/kvm/tests/guest_test.py +++ b/client/tests/kvm/tests/guest_test.py @@ -28,7 +28,7 @@ def run_guest_test(test, params, env): if reboot == "yes": logging.debug("Rebooting guest before test ...") - session = kvm_test_utils.reboot(vm, session, timeout=login_timeout) + session = vm.reboot(session, timeout=login_timeout) try: logging.info("Starting script...") @@ -74,7 +74,7 @@ def run_guest_test(test, params, env): if reboot == "yes": logging.debug("Rebooting guest after test ...") - session = kvm_test_utils.reboot(vm, session, timeout=login_timeout) + session = vm.reboot(session, timeout=login_timeout) logging.debug("guest test PASSED.") finally: diff --git a/client/tests/kvm/tests/iofuzz.py b/client/tests/kvm/tests/iofuzz.py index d995509..ed22814 100644 --- a/client/tests/kvm/tests/iofuzz.py +++ b/client/tests/kvm/tests/iofuzz.py @@ -82,8 +82,7 @@ def run_iofuzz(test, params, env): session = vm.wait_for_login(timeout=10) except: logging.debug("Could not re-login, reboot the guest") - session = kvm_test_utils.reboot(vm, session, - method = "system_reset") + session = vm.reboot(method="system_reset") else: raise error.TestFail("VM has quit abnormally during %s", (op, operand)) diff --git a/client/tests/kvm/tests/kdump.py b/client/tests/kvm/tests/kdump.py index bfcbae1..70217ad 100644 --- a/client/tests/kvm/tests/kdump.py +++ b/client/tests/kvm/tests/kdump.py @@ -61,7 +61,7 @@ def run_kdump(test, params, env): except: logging.info("Crash kernel is not loaded. Trying to load it") session.cmd(kernel_param_cmd) - session = kvm_test_utils.reboot(vm, session, timeout=timeout) + session = vm.reboot(session, timeout=timeout) logging.info("Enabling kdump service...") # the initrd may be rebuilt here so we need to wait a little more diff --git a/client/tests/kvm/tests/migration_with_reboot.py b/client/tests/kvm/tests/migration_with_reboot.py index a365239..671f1ef 100644 --- a/client/tests/kvm/tests/migration_with_reboot.py +++ b/client/tests/kvm/tests/migration_with_reboot.py @@ -30,7 +30,7 @@ def run_migration_with_reboot(test, params, env): try: # Reboot the VM in the background - bg = kvm_utils.Thread(kvm_test_utils.reboot, (vm, session)) + bg = kvm_utils.Thread(vm.reboot, (session,)) bg.start() try: while bg.is_alive(): diff --git a/client/tests/kvm/tests/timedrift_with_reboot.py b/client/tests/kvm/tests/timedrift_with_reboot.py index 8ec121d..a1ab5f3 100644 --- a/client/tests/kvm/tests/timedrift_with_reboot.py +++ b/client/tests/kvm/tests/timedrift_with_reboot.py @@ -47,7 +47,7 @@ def run_timedrift_with_reboot(test, params, env): # Run current iteration logging.info("Rebooting: iteration %d of %d..." % (i + 1, reboot_iterations)) - session = kvm_test_utils.reboot(vm, session) + session = vm.reboot(session) # Get time after current iteration (ht1_, gt1_) = kvm_test_utils.get_time(session, time_command, time_filter_re, time_format) diff --git a/client/tests/kvm/tests/virtio_console.py b/client/tests/kvm/tests/virtio_console.py index d7aaaf6..5f1e20a 100644 --- a/client/tests/kvm/tests/virtio_console.py +++ b/client/tests/kvm/tests/virtio_console.py @@ -1156,7 +1156,7 @@ def run_virtio_console(test, params, env): logging.error("Virtio-console driver is irreparably" " blocked. Every comd end with sig KILL." "Try reboot vm for continue in testing.") - vm[1] = kvm_test_utils.reboot(vm[0], vm[1], "system_reset") + vm[1] = vm[0].reboot(vm[1], "system_reset") init_guest(vm, consoles) (match, data) = _on_guest("virt.clean_port('%s'),1024" % consoles[0][0].name, vm, 2) diff --git a/client/tests/kvm/tests/whql_client_install.py b/client/tests/kvm/tests/whql_client_install.py index 5a2ed4d..1459793 100644 --- a/client/tests/kvm/tests/whql_client_install.py +++ b/client/tests/kvm/tests/whql_client_install.py @@ -99,7 +99,7 @@ def run_whql_client_install(test, params, env): session.cmd(cmd, timeout=300) # Reboot - session = kvm_test_utils.reboot(vm, session) + session = vm.reboot(session) # Access shared resources on the server machine logging.info("Attempting to access remote share on server") @@ -132,5 +132,5 @@ def run_whql_client_install(test, params, env): session.cmd(cmd % ("DefaultPassword", client_password)) # Reboot one more time - session = kvm_test_utils.reboot(vm, session) + session = vm.reboot(session) session.close() diff --git a/client/tests/kvm/tests/whql_submission.py b/client/tests/kvm/tests/whql_submission.py index afd613e..6a9407f 100644 --- a/client/tests/kvm/tests/whql_submission.py +++ b/client/tests/kvm/tests/whql_submission.py @@ -74,7 +74,7 @@ def run_whql_submission(test, params, env): server_session.cmd(cmd, print_func=logging.debug) # Reboot the client machines - sessions = kvm_utils.parallel((kvm_test_utils.reboot, (vm, session)) + sessions = kvm_utils.parallel((vm.reboot, (session,)) for vm, session in zip(vms, sessions)) # Check the NICs again