From mboxrd@z Thu Jan 1 00:00:00 1970 From: tangchen Subject: Re: [PATCH 0/3] Add migration function and test for libvirt. Date: Tue, 17 Jan 2012 11:24:53 +0800 Message-ID: <4F14EA05.9040506@cn.fujitsu.com> References: <4F14E93A.1080902@cn.fujitsu.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Lucas Meneghel Rodrigues , autotest@test.kernel.org, kvm@vger.kernel.org Return-path: In-Reply-To: <4F14E93A.1080902@cn.fujitsu.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: autotest-bounces@test.kernel.org Errors-To: autotest-bounces@test.kernel.org List-Id: kvm.vger.kernel.org This patch tests the "virsh migrate" command with --live parameter. Signed-off-by: Tang Chen --- client/tests/libvirt/tests/virsh_migrate.py | 33 +++++++++++++++++++++++++++ 1 files changed, 33 insertions(+), 0 deletions(-) create mode 100644 client/tests/libvirt/tests/virsh_migrate.py diff --git a/client/tests/libvirt/tests/virsh_migrate.py b/client/tests/libvirt/tests/virsh_migrate.py new file mode 100644 index 0000000..5576e78 --- /dev/null +++ b/client/tests/libvirt/tests/virsh_migrate.py @@ -0,0 +1,33 @@ +import re, os, logging, commands, shutil +from autotest_lib.client.common_lib import utils, error +from autotest_lib.client.virt import virt_vm, virt_utils, virt_env_process + +def run_virsh_migrate(test, params, env): + """ + Test the migrate command with parameter --live. + """ + + vm_name = params.get("main_vm") + vm = env.get_vm(params["main_vm"]) + vm.verify_alive() + + destuser = params.get("destuser") + destpwd = params.get("destpwd") + destip = params.get("destip") + destprompt = params.get("destprompt") + + # Migrate the guest. + ret = vm.migrate() + if ret == False: + raise error.TestFail("Migration of %s failed." % vm_name) + + session = virt_utils.remote_login("ssh", destip, "22", destuser, destpwd, destprompt) + status, output = session.cmd_status_output("virsh domstate %s" % vm_name) + logging.info("Out put of virsh domstate %s: %s" % (vm_name, output)) + + if status == 0 and output.find("running") >= 0: + logging.info("Running guest %s is found on destination." % vm_name) + session.cmd("virsh destroy %s" % vm_name) + else: + raise error.TestFail("Destination has no running guest named %s." % vm_name) + -- 1.7.3.1 -- Best Regards, Tang chen