From: 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> References: <1293465715-16599-1-git-send-email-mgoldish@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: autotest@test.kernel.org, kvm@vger.kernel.org Return-path: In-Reply-To: <1293465715-16599-1-git-send-email-mgoldish@redhat.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: autotest-bounces@test.kernel.org Errors-To: autotest-bounces@test.kernel.org List-Id: kvm.vger.kernel.org Signed-off-by: Michael Goldish --- client/tests/kvm/tests/migration_with_reboot.py | 19 +++++++------------ 1 files changed, 7 insertions(+), 12 deletions(-) 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() -- 1.7.3.3