From patchwork Mon Dec 27 16:01:31 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Goldish X-Patchwork-Id: 434351 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 oBRKCV9U025997 for ; Mon, 27 Dec 2010 20:16:52 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754352Ab0L0QCS (ORCPT ); Mon, 27 Dec 2010 11:02:18 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44702 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754326Ab0L0QCL (ORCPT ); Mon, 27 Dec 2010 11:02:11 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id oBRG2A1Q028867 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 27 Dec 2010 11:02:10 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id oBRG29aO003532; Mon, 27 Dec 2010 11:02:10 -0500 Received: from moof.tlv.redhat.com (dhcp-1-185.tlv.redhat.com [10.35.1.185]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id oBRG1rFq017175; Mon, 27 Dec 2010 11:02:08 -0500 From: Michael Goldish To: autotest@test.kernel.org, kvm@vger.kernel.org Cc: Michael Goldish Subject: [KVM-AUTOTEST PATCH 04/28] KVM test: migration_with_reboot: use kvm_utils.Thread Date: Mon, 27 Dec 2010 18:01:31 +0200 Message-Id: <1293465715-16599-4-git-send-email-mgoldish@redhat.com> In-Reply-To: <1293465715-16599-1-git-send-email-mgoldish@redhat.com> References: <1293465715-16599-1-git-send-email-mgoldish@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 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 (demeter1.kernel.org [140.211.167.41]); Mon, 27 Dec 2010 20:16:53 +0000 (UTC) diff --git a/client/tests/kvm/tests/migration_with_reboot.py b/client/tests/kvm/tests/migration_with_reboot.py index 5070dbc..af5de64 100644 --- a/client/tests/kvm/tests/migration_with_reboot.py +++ b/client/tests/kvm/tests/migration_with_reboot.py @@ -19,7 +19,6 @@ def run_migration_with_reboot(test, params, env): @param params: Dictionary with test parameters. @param env: Dictionary with the test environment. """ - def reboot_test(client, session, address, reboot_command, port, username, password, prompt, linesep, log_filename, timeout): """ @@ -67,24 +66,20 @@ def run_migration_with_reboot(test, params, env): mig_timeout = float(params.get("mig_timeout", "3600")) mig_protocol = params.get("migration_protocol", "tcp") mig_cancel = bool(params.get("mig_cancel")) - bg = None try: - # reboot the VM in background - bg = kvm_test_utils.BackgroundTest(reboot_test, - (client, session, address, + # Reboot the VM in the background + bg = kvm_utils.Thread(reboot_test, (client, session, address, reboot_command, port, username, password, prompt, linesep, log_filename, timeout)) bg.start() - while bg.is_alive(): - # Migrate the VM - dest_vm = kvm_test_utils.migrate(vm, env, mig_timeout, mig_protocol, - False) - vm = dest_vm + try: + while bg.is_alive(): + vm = kvm_test_utils.migrate(vm, env, mig_timeout, mig_protocol) + finally: + bg.join() finally: - if bg: - bg.join() session.close()