From patchwork Wed Dec 1 02:54:19 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas Meneghel Rodrigues X-Patchwork-Id: 369521 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 oB12sSqX019673 for ; Wed, 1 Dec 2010 02:54:28 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754183Ab0LACy0 (ORCPT ); Tue, 30 Nov 2010 21:54:26 -0500 Received: from mx1.redhat.com ([209.132.183.28]:30035 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753948Ab0LACyZ (ORCPT ); Tue, 30 Nov 2010 21:54:25 -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 oB12sOKH032386 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 30 Nov 2010 21:54:24 -0500 Received: from freedom.redhat.com (vpn-11-100.rdu.redhat.com [10.11.11.100]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id oB12sMIY008171; Tue, 30 Nov 2010 21:54:23 -0500 From: Lucas Meneghel Rodrigues To: autotest@test.kernel.org Cc: kvm@vger.kernel.org, Lucas Meneghel Rodrigues Subject: [PATCH 3/4] KVM test: Add migration server control file Date: Wed, 1 Dec 2010 00:54:19 -0200 Message-Id: <1291172060-14413-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.3 (demeter1.kernel.org [140.211.167.41]); Wed, 01 Dec 2010 02:54:28 +0000 (UTC) diff --git a/client/tests/kvm/migration_control.srv b/client/tests/kvm/migration_control.srv new file mode 100644 index 0000000..781e820 --- /dev/null +++ b/client/tests/kvm/migration_control.srv @@ -0,0 +1,103 @@ +AUTHOR = "Yolkfull Chow " +TIME = "SHORT" +NAME = "Migration across multiple hosts" +TEST_CATEGORY = "Functional" +TEST_CLASS = "Virtualization" +TEST_TYPE = "Server" +DOC = """ +Migrate KVM guest between two hosts. It parses the base config file, restricts +it with appropriate parameters, generates the test dicts, modify the test_dicts +so there's a distinction between the migration roles ('dest' or 'source'). +""" + +import sys, os, commands, glob, shutil, logging +from autotest_lib.server import utils + +# Specify the directory of autotest before you start this test +AUTOTEST_DIR = '/usr/local/autotest' + +# Specify the root directory that on client machines +rootdir = '/tmp/kvm_autotest_root' + +# Make possible to import the KVM test APIs +KVM_DIR = os.path.join(AUTOTEST_DIR, 'client/tests/kvm') +sys.path.append(KVM_DIR) + +import common, kvm_config + +def run(pair): + logging.info("KVM migration running on source host [%s] and destination " + "host [%s]\n", pair[0], pair[1]) + + source = hosts.create_host(pair[0]) + dest = hosts.create_host(pair[1]) + source_at = autotest.Autotest(source) + dest_at = autotest.Autotest(dest) + + cfg_file = os.path.join(KVM_DIR, "tests_base.cfg") + + if not os.path.exists(cfg_file): + raise error.JobError("Config file %s was not found", cfg_file) + + # Get test set (dictionary list) from the configuration file + cfg = kvm_config.config() + test_variants = """ +image_name(_.*)? ?<= /tmp/kvm_autotest_root/images/ +cdrom(_.*)? ?<= /tmp/kvm_autotest_root/ +floppy ?<= /tmp/kvm_autotest_root/ +Linux: + unattended_install: + kernel ?<= /tmp/kvm_autotest_root/ + initrd ?<= /tmp/kvm_autotest_root/ +only qcow2 +only virtio_net +only virtio_blk +only smp2 +only no_pci_assignable +only smallpages +only Fedora.13.64 +only migrate_multi_host +nic_mode = tap +""" + cfg.fork_and_parse(cfg_file, test_variants) + test_list = cfg.get_list() + + for params in test_list: + params['srchost'] = source.ip + params['dsthost'] = dest.ip + params['rootdir'] = rootdir + + source_params = params.copy() + source_params['role'] = "source" + + dest_params = params.copy() + dest_params['role'] = "destination" + dest_params['migration_mode'] = "tcp" + + # Report the parameters we've received + print "Test parameters:" + keys = test_dict.keys() + keys.sort() + for key in keys: + logging.debug(" %s = %s", key, test_dict[key]) + + source_control_file = "job.run_test('kvm', params=%s)" % source_dict + dest_control_file = "job.run_test('kvm', params=%s)" % dest_dict + + dest_command = subcommand(dest_at.run, + [dest_control_file, dest.hostname]) + + source_command = subcommand(source_at.run, + [source_control_file, source.hostname]) + + parallel([dest_command, source_command]) + +# Grab the pairs (and failures) +(pairs, failures) = utils.form_ntuples_from_machines(machines, 2) + +# Log the failures +for failure in failures: + job.record("FAIL", failure[0], "kvm", failure[1]) + +# Now run through each pair and run +job.parallel_simple(run, pairs, log=False)