From patchwork Sat Sep 25 09:36:48 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Wang X-Patchwork-Id: 208832 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 o8P9WKw7013366 for ; Sat, 25 Sep 2010 09:32:21 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754499Ab0IYJcR (ORCPT ); Sat, 25 Sep 2010 05:32:17 -0400 Received: from mx1.redhat.com ([209.132.183.28]:1632 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754465Ab0IYJcQ (ORCPT ); Sat, 25 Sep 2010 05:32:16 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o8P9WF82032354 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sat, 25 Sep 2010 05:32:15 -0400 Received: from dhcp-91-158.nay.redhat.com (dhcp-91-158.nay.redhat.com [10.66.91.158]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o8P9WDSp009225; Sat, 25 Sep 2010 05:32:14 -0400 Subject: [PATCH 2/3] KVM test: Test reboot during migration To: lmr@redhat.com, autotest@test.kernel.org From: Jason Wang Cc: kvm@vger.kernel.org, mst@redhat.com Date: Sat, 25 Sep 2010 17:36:48 +0800 Message-ID: <20100925093648.28158.18879.stgit@dhcp-91-158.nay.redhat.com> In-Reply-To: <20100925092836.28158.64788.stgit@dhcp-91-158.nay.redhat.com> References: <20100925092836.28158.64788.stgit@dhcp-91-158.nay.redhat.com> User-Agent: StGit/0.15 MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 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]); Sat, 25 Sep 2010 09:32:21 +0000 (UTC) diff --git a/client/tests/kvm/tests/migration_with_reboot.py b/client/tests/kvm/tests/migration_with_reboot.py new file mode 100644 index 0000000..985cb3a --- /dev/null +++ b/client/tests/kvm/tests/migration_with_reboot.py @@ -0,0 +1,45 @@ +import logging, time +import threading +from autotest_lib.client.common_lib import error +import kvm_subprocess, kvm_test_utils, kvm_utils + + +def run_migration_with_reboot(test, params, env): + """ + KVM migration test: + 1) Get a live VM and clone it. + 2) Verify that the source VM supports migration. If it does, proceed with + the test. + 3) Reboot the VM + 4) Send a migration command to the source VM and wait until it's finished. + 5) Kill off the source VM. + 6) Log into the destination VM after the migration is finished. + + @param test: kvm test object. + @param params: Dictionary with test parameters. + @param env: Dictionary with the test environment. + """ + vm = kvm_test_utils.get_living_vm(env, params.get("main_vm")) + timeout = int(params.get("login_timeout", 360)) + session = kvm_test_utils.wait_for_login(vm, timeout=timeout) + + 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(kvm_test_utils.reboot, (vm, session)) + 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 + + finally: + if bg: + bg.join() + session.close() diff --git a/client/tests/kvm/tests_base.cfg.sample b/client/tests/kvm/tests_base.cfg.sample index c8fbf50..1565dce 100644 --- a/client/tests/kvm/tests_base.cfg.sample +++ b/client/tests/kvm/tests_base.cfg.sample @@ -150,6 +150,11 @@ variants: - mig_cancel: migration_protocol = "tcp" mig_cancel = True + variants: + - @default: + - with_reboot: + iterations = 1 + type = migration_with_reboot - boot_savevm: install setup unattended_install.cdrom type = boot_savevm