This patch tests the "virsh migrate" command with --live parameter. Signed-off-by: Tang Chen <tangchen@xxxxxxxxxxxxxx> --- 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 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html