Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

migration: add case about migrate vm which have vmx-* cpu features #6139

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
- migration.migration_misc.migration_with_vmx_cpu_features:
type = migration_with_vmx_cpu_features
migration_setup = 'yes'
storage_type = 'nfs'
setup_local_nfs = 'yes'
disk_type = "file"
disk_source_protocol = "netfs"
mnt_path_name = ${nfs_mount_dir}
# Console output can only be monitored via virsh console output
only_pty = True
take_regular_screendumps = no
# Extra options to pass after <domain> <desturi>
virsh_migrate_extra = ''
# SSH connection time out
ssh_timeout = 60
# Local URI
virsh_migrate_connect_uri = 'qemu:///system'
image_convert = 'no'
server_ip = "${migrate_dest_host}"
server_user = "root"
server_pwd = "${migrate_dest_pwd}"
status_error = "no"
migrate_desturi_port = "16509"
migrate_desturi_type = "tcp"
virsh_migrate_desturi = "qemu+tcp://${migrate_dest_host}/system"
start_vm = "no"
variants:
- p2p:
virsh_migrate_options = '--live --p2p --verbose'
- non_p2p:
virsh_migrate_options = '--live --verbose'
variants migration_option:
- with_xml:
- without_xml:
variants cpu_mode:
- host_model:
numa_cell = "'numa_cell': [{'cpus': '0-1', 'memory': '2097152', 'unit': 'KiB'}]"
vm_attrs = {'cpu': {'mode': 'host-model', 'check': 'partial', ${numa_cell}}}
- custom:
cpu_mode = "custom"
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import os

from avocado.utils import process

from virttest import data_dir
from virttest import virsh
from virttest.libvirt_xml import vm_xml

from provider.migration import base_steps


def run(test, params, env):
"""
Verify that migration can succeed when host and guest have vmx-* cpu
features.

:param test: test object
:param params: Dictionary with the test parameters
:param env: Dictionary with test environment.
"""
def setup_test():
"""
Setup steps

"""
cpu_mode = params.get("cpu_mode")
migration_option = params.get("migration_option")

test.log.info("Setup steps.")
migration_obj.setup_connection()
vmxml = vm_xml.VMXML.new_from_dumpxml(vm_name)
if cpu_mode == "host_model":
vm_attrs = eval(params.get('vm_attrs', '{}'))
vmxml.setup_attrs(**vm_attrs)
vmxml.sync()
else:
base_steps.sync_cpu_for_mig(params)

if not vm.is_alive():
vm.start()
vm.wait_for_login().close()

if migration_option == "with_xml":
xmlfile = os.path.join(data_dir.get_tmp_dir(), '%s.xml' % vm_name)
virsh.dumpxml(vm_name, extra="--migratable", to_file=xmlfile, ignore_status=False)
params.update({"virsh_migrate_extra": f"--xml {xmlfile}"})

vm_name = params.get("migrate_main_vm")

vm = env.get_vm(vm_name)
migration_obj = base_steps.MigrationBase(test, vm, params)

cmd = "virsh domcapabilities |grep vmx- |wc -l"
ret = process.run(cmd, shell=True).stdout_text.strip()
if int(ret) == 0:
test.cancel("Please use the host with vmx-* cpu features to test.")
try:
setup_test()
migration_obj.run_migration()
migration_obj.verify_default()
finally:
migration_obj.cleanup_connection()
1 change: 1 addition & 0 deletions spell.ignore
Original file line number Diff line number Diff line change
Expand Up @@ -1199,6 +1199,7 @@ vms
VMs
vmtype
vmware
vmx
vmxml
vnc
vncdisplay
Expand Down