From patchwork Tue Jan 11 05:22:03 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas Meneghel Rodrigues X-Patchwork-Id: 470241 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 p0B5MZAr001792 for ; Tue, 11 Jan 2011 05:22:35 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752119Ab1AKFWN (ORCPT ); Tue, 11 Jan 2011 00:22:13 -0500 Received: from mx1.redhat.com ([209.132.183.28]:11905 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752078Ab1AKFWK (ORCPT ); Tue, 11 Jan 2011 00:22:10 -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 p0B5M8dR023203 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 11 Jan 2011 00:22:08 -0500 Received: from freedom.redhat.com (vpn-10-42.rdu.redhat.com [10.11.10.42]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p0B5M6iI029274; Tue, 11 Jan 2011 00:22:07 -0500 From: Lucas Meneghel Rodrigues To: autotest@test.kernel.org Cc: kvm@vger.kernel.org, Jason Wang Subject: [PATCH 1/2] KVM test: Add the ability to test migration during guest installation Date: Tue, 11 Jan 2011 03:22:03 -0200 Message-Id: <1294723324-20757-1-git-send-email-lmr@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.6 (demeter1.kernel.org [140.211.167.41]); Tue, 11 Jan 2011 05:22:35 +0000 (UTC) diff --git a/client/tests/kvm/tests/unattended_install.py b/client/tests/kvm/tests/unattended_install.py index 9617603..fdb020a 100644 --- a/client/tests/kvm/tests/unattended_install.py +++ b/client/tests/kvm/tests/unattended_install.py @@ -1,4 +1,4 @@ -import logging, time, socket +import logging, time, socket, re from autotest_lib.client.common_lib import error import kvm_utils, kvm_test_utils @@ -24,6 +24,11 @@ def run_unattended_install(test, params, env): post_install_delay = 0 install_timeout = float(params.get("timeout", 3000)) + migrate_background = params.get("migrate_background") == "yes" + if migrate_background: + mig_timeout = float(params.get("mig_timeout", "3600")) + mig_protocol = params.get("migration_protocol", "tcp") + logging.info("Starting unattended install watch process. " "Timeout set to %ds (%d min)", install_timeout, install_timeout/60) @@ -46,7 +51,20 @@ def run_unattended_install(test, params, env): break except socket.error: pass - time.sleep(1) + + if migrate_background: + # Drop the params which may break the migration + # Better method is to used dnsmasq to do the unattended installation + if vm.params.get("initrd"): + vm.params["initrd"] = None + if vm.params.get("kernel"): + vm.params["kernel"] = None + if vm.params.get("extra_params"): + vm.params["extra_params"] = re.sub("--append '.*'", "", + vm.params["extra_params"]) + vm.migrate(timeout=mig_timeout, protocol=mig_protocol) + else: + time.sleep(1) client.close() end_time = time.time() time_elapsed = int(end_time - start_time) diff --git a/client/tests/kvm/tests_base.cfg.sample b/client/tests/kvm/tests_base.cfg.sample index 6374923..047b0f3 100644 --- a/client/tests/kvm/tests_base.cfg.sample +++ b/client/tests/kvm/tests_base.cfg.sample @@ -103,6 +103,9 @@ variants: kernel = vmlinuz initrd = initrd.img nic_mode = tap + # uncomment the following line to test the migration in parallel + # migrate_with_background = yes + variants: # Install guest from cdrom - cdrom: