From patchwork Tue Jan 11 05:22:04 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: 470251 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 p0B5MZAs001792 for ; Tue, 11 Jan 2011 05:22:35 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752142Ab1AKFWQ (ORCPT ); Tue, 11 Jan 2011 00:22:16 -0500 Received: from mx1.redhat.com ([209.132.183.28]:3166 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752100Ab1AKFWL (ORCPT ); Tue, 11 Jan 2011 00:22: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 p0B5MAu1000642 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 11 Jan 2011 00:22:10 -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 p0B5M6iJ029274; Tue, 11 Jan 2011 00:22:08 -0500 From: Lucas Meneghel Rodrigues To: autotest@test.kernel.org Cc: kvm@vger.kernel.org, Jason Wang Subject: [PATCH 2/2] KVM test: Run client tests of autotest in parallel with migration Date: Tue, 11 Jan 2011 03:22:04 -0200 Message-Id: <1294723324-20757-2-git-send-email-lmr@redhat.com> In-Reply-To: <1294723324-20757-1-git-send-email-lmr@redhat.com> References: <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:36 +0000 (UTC) diff --git a/client/tests/kvm/kvm_test_utils.py b/client/tests/kvm/kvm_test_utils.py index c1bff29..c9a9b42 100644 --- a/client/tests/kvm/kvm_test_utils.py +++ b/client/tests/kvm/kvm_test_utils.py @@ -429,7 +429,7 @@ def get_memory_info(lvms): return meminfo -def run_autotest(vm, session, control_path, timeout, outputdir): +def run_autotest(vm, session, control_path, timeout, outputdir, params): """ Run an autotest control file inside a guest (linux only utility). @@ -439,6 +439,9 @@ def run_autotest(vm, session, control_path, timeout, outputdir): @param timeout: Timeout under which the autotest control file must complete. @param outputdir: Path on host where we should copy the guest autotest results to. + + The following params is used by the migration + @param params: Test params used in the migration test """ def copy_if_hash_differs(vm, local_path, remote_path): """ @@ -515,6 +518,11 @@ def run_autotest(vm, session, control_path, timeout, outputdir): raise error.TestError("Invalid path to autotest control file: %s" % control_path) + 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") + compressed_autotest_path = "/tmp/autotest.tar.bz2" # To avoid problems, let's make the test use the current AUTODIR @@ -551,12 +559,31 @@ def run_autotest(vm, session, control_path, timeout, outputdir): except kvm_subprocess.ShellError: pass try: + bg = None try: logging.info("---------------- Test output ----------------") - session.cmd_output("bin/autotest control", timeout=timeout, - print_func=logging.info) + if migrate_background: + mig_timeout = float(params.get("mig_timeout", "3600")) + mig_protocol = params.get("migration_protocol", "tcp") + + bg = kvm_utils.Thread(session.cmd_output, + kwargs={'cmd': "bin/autotest control", + 'timeout': timeout, + 'print_func': logging.info}) + + bg.start() + + while bg.is_alive(): + logging.info("Tests is not ended, start a round of" + "migration ...") + vm.migrate(timeout=mig_timeout, protocol=mig_protocol) + else: + session.cmd_output("bin/autotest control", timeout=timeout, + print_func=logging.info) finally: logging.info("------------- End of test output ------------") + if migrate_background and bg: + bg.join() except kvm_subprocess.ShellTimeoutError: if vm.is_alive(): get_results() diff --git a/client/tests/kvm/tests/autotest.py b/client/tests/kvm/tests/autotest.py index 0b97b03..37e1b00 100644 --- a/client/tests/kvm/tests/autotest.py +++ b/client/tests/kvm/tests/autotest.py @@ -19,8 +19,11 @@ def run_autotest(test, params, env): # Collect test parameters timeout = int(params.get("test_timeout", 300)) + migrate = params.get("migrate" , "no") == "yes" control_path = os.path.join(test.bindir, "autotest_control", params.get("test_control_file")) outputdir = test.outputdir - kvm_test_utils.run_autotest(vm, session, control_path, timeout, outputdir) + kvm_test_utils.run_autotest(vm, session, control_path, timeout, outputdir, + params) + diff --git a/client/tests/kvm/tests_base.cfg.sample b/client/tests/kvm/tests_base.cfg.sample index 047b0f3..c5d9ca3 100644 --- a/client/tests/kvm/tests_base.cfg.sample +++ b/client/tests/kvm/tests_base.cfg.sample @@ -170,6 +170,17 @@ variants: - with_file_transfer: iterations = 1 type = migration_with_file_transfer + - with_autotest: + type = autotest + migrate_background = yes + test_timeout = 1800 + variants: + - dbench: + test_control_file = dbench.control + - stress: + test_control_file = stress.control + - monotonic_time: + test_control_file = monotonic_time.control - migrate_multi_host: install setup unattended_install.cdrom type = migration_multi_host