From patchwork Fri Nov 26 23:01:14 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: 360102 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 oAQN1SqS004705 for ; Fri, 26 Nov 2010 23:01:28 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753049Ab0KZXBY (ORCPT ); Fri, 26 Nov 2010 18:01:24 -0500 Received: from mx1.redhat.com ([209.132.183.28]:40244 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752031Ab0KZXBX (ORCPT ); Fri, 26 Nov 2010 18:01:23 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id oAQN1MJa027462 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 26 Nov 2010 18:01:22 -0500 Received: from freedom.redhat.com (vpn-11-239.rdu.redhat.com [10.11.11.239]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id oAQN1Gsm005815; Fri, 26 Nov 2010 18:01:21 -0500 From: Lucas Meneghel Rodrigues To: autotest@test.kernel.org Cc: kvm@vger.kernel.org, Jason Wang Subject: [PATCH 3/3] KVM test: Test the file transfer during migartion Date: Fri, 26 Nov 2010 21:01:14 -0200 Message-Id: <1290812474-21377-3-git-send-email-lmr@redhat.com> In-Reply-To: <1290812474-21377-1-git-send-email-lmr@redhat.com> References: <1290812474-21377-1-git-send-email-lmr@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 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]); Fri, 26 Nov 2010 23:01:29 +0000 (UTC) diff --git a/client/tests/kvm/tests/migration_with_file_transfer.py b/client/tests/kvm/tests/migration_with_file_transfer.py new file mode 100644 index 0000000..8a316bf --- /dev/null +++ b/client/tests/kvm/tests/migration_with_file_transfer.py @@ -0,0 +1,59 @@ +import logging, time +from autotest_lib.client.common_lib import utils, error +import kvm_subprocess, kvm_test_utils, kvm_utils + + +def run_migration_with_file_transfer(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. + """ + + def transfer_test(vm, host_path, guest_path, timeout=120): + """ + vm.copy_files_to does not raise exception, so we need a wrapper + in order to make it to be used by BackgroundTest. + """ + if not vm.copy_files_to(host_path, guest_path, timeout=timeout): + raise error.TestError("Fail to do the file transfer!") + + 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") + + guest_path = params.get("guest_path", "/tmp") + file_size = params.get("file_size", "1000") + transfer_timeout = int(params.get("transfer_timeout", "240")) + bg = None + + try: + utils.run("dd if=/dev/zero of=/tmp/file bs=1M count=%s" % file_size) + + # Transfer file from host to guest + bg = kvm_test_utils.BackgroundTest(transfer_test, + (vm, "/tmp/file", guest_path, + transfer_timeout)) + bg.start() + + while bg.is_alive(): + logging.info("File transfer is not ended, start a round of migration ...") + # 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() + utils.run("rm -rf /tmp/zero") diff --git a/client/tests/kvm/tests_base.cfg.sample b/client/tests/kvm/tests_base.cfg.sample index 8f6984c..2e06c3b 100644 --- a/client/tests/kvm/tests_base.cfg.sample +++ b/client/tests/kvm/tests_base.cfg.sample @@ -152,6 +152,9 @@ variants: - with_reboot: iterations = 1 type = migration_with_reboot + - with_file_transfer: + iterations = 1 + type = migration_with_file_transfer - boot_savevm: install setup unattended_install.cdrom type = boot_savevm @@ -1570,6 +1573,10 @@ variants: migration_bg_command = start ping -t localhost migration_bg_check_command = tasklist | find /I "ping.exe" migration_bg_kill_command = taskkill /IM ping.exe /F + migrate_with_file_transfer: + guest_path = C:\ + rtl8139: + file_size = 10 stress_boot: alive_test_cmd = systeminfo timedrift: