-
Notifications
You must be signed in to change notification settings - Fork 167
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
migration: add case about migrate vm which have vmx-* cpu features
XXX-303279 - [VM migration] migrate vm which have vmx-* cpu features Signed-off-by: lcheng <lcheng@redhat.com>
- Loading branch information
Showing
3 changed files
with
103 additions
and
0 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
libvirt/tests/cfg/migration/migration_misc/migration_with_vmx_cpu_features.cfg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
62 changes: 62 additions & 0 deletions
62
libvirt/tests/src/migration/migration_misc/migration_with_vmx_cpu_features.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1199,6 +1199,7 @@ vms | |
VMs | ||
vmtype | ||
vmware | ||
vmx | ||
vmxml | ||
vnc | ||
vncdisplay | ||
|