diff --git a/libvirt/tests/cfg/memory/nvdimm.cfg b/libvirt/tests/cfg/memory/nvdimm.cfg index d7c0d003f15..0a353d31848 100644 --- a/libvirt/tests/cfg/memory/nvdimm.cfg +++ b/libvirt/tests/cfg/memory/nvdimm.cfg @@ -2,10 +2,12 @@ type = nvdimm start_vm = no nvdimm_file_size = '512M' + cpuxml_mode = host-model + aarch64: + cpuxml_mode = host-passthrough variants: - back_file: nvdimm_file = /tmp/nvdimm - cpuxml_mode = host-model cpuxml_check = partial cpuxml_fallback = allow nvdimmxml_mem_model = nvdimm @@ -37,6 +39,8 @@ - default: - check_life_cycle: check_life_cycle = "yes" + error_msg_1 = "unsupported configuration: revert to external snapshot not supported yet" + error_msg_2 = "internal error: Invalid target domain state 'disk-snapshot'. Refusing snapshot reversion" - discard: check = discard nvdimmxml_discard = yes @@ -46,7 +50,7 @@ check = pmem_alignsize nvdimm_file_path = '/tmp/nvdimm' alignsize = 2048 - vm_attrs = {'max_mem_rt': 8192, 'max_mem_rt_slots': 8, 'max_mem_rt_unit': 'M', 'vcpu': 4, 'cpu': {'mode': 'host-model', 'numa_cell': [{'id': '0', 'cpus': '0-1', 'memory': '2097152', 'unit': 'K'}, {'id': '1', 'cpus': '2-3', 'memory': '2097152', 'unit': 'K'}]}} + vm_attrs = {'max_mem_rt': 8192, 'max_mem_rt_slots': 8, 'max_mem_rt_unit': 'M', 'vcpu': 4, 'cpu': {'mode': '${cpuxml_mode}', 'numa_cell': [{'id': '0', 'cpus': '0-1', 'memory': '2097152', 'unit': 'K'}, {'id': '1', 'cpus': '2-3', 'memory': '2097152', 'unit': 'K'}]}} mem_device_attrs = {'mem_model': 'nvdimm', 'source': {'path': '${nvdimm_file_path}', 'alignsize': ${alignsize}, 'alignsize_unit': 'K', 'pmem': True}, 'target': {'size': 512, 'size_unit': 'M', 'node': 1, 'readonly': True, 'label': {'size': 128, 'size_unit': 'KiB'}}} qemu_checks = "align.*pmem" error_msg = "['pwrite.* failed: Operation not permitted', 'wrong fs type, bad option, bad superblock on /dev/pmem0']" @@ -113,7 +117,6 @@ nvdimmxml2_label_size = 128 nvdimmxml2_label_size_unit = KiB nvdimmxml2_address_slot = 1 - cpuxml_mode = host-model cpuxml_check = partial cpuxml_fallback = allow cpuxml_topology = {'sockets': '2', 'cores': '2', 'threads': '1'} diff --git a/libvirt/tests/src/memory/nvdimm.py b/libvirt/tests/src/memory/nvdimm.py index 3eba7f00873..e57a199a270 100644 --- a/libvirt/tests/src/memory/nvdimm.py +++ b/libvirt/tests/src/memory/nvdimm.py @@ -7,6 +7,7 @@ from avocado.utils import process from virttest import libvirt_version +from virttest import xml_utils from virttest import virsh from virttest import utils_hotplug from virttest import utils_package @@ -339,9 +340,30 @@ def test_with_label(vm, params, test): vm_session = vm.wait_for_login() check_nvdimm_file(test_str, test_file, vm_session, test) vm_session.close() - virsh.snapshot_create_as(vm_name, vm_s1, ignore_status=False, debug=True) - virsh.snapshot_revert(vm_name, vm_s1, ignore_status=False, debug=True) - virsh.snapshot_delete(vm_name, vm_s1, ignore_status=False, debug=True) + if platform.machine() == 'aarch64': + virsh.snapshot_create_as(vm_name, "%s --disk-only" % vm_s1, + ignore_status=False, debug=True) + revert_result = virsh.snapshot_revert(vm_name, vm_s1, debug=True) + if revert_result.exit_status: + error_msg_1 = params.get('error_msg_1') + error_msg_2 = params.get('error_msg_2') + if not re.search(error_msg_1, revert_result.stderr) \ + and not re.search(error_msg_2, revert_result.stderr): + test.fail("The error '{}' or '{}' should be in the output \n'{}'" % + format(error_msg_1, error_msg_2, revert_result.stderr)) + if libvirt_version.version_compare(9, 10, 0): + virsh.snapshot_delete(vm_name, vm_s1, ignore_status=False, debug=True) + else: + virsh.snapshot_delete(vm_name, "%s --metadata" % vm_s1, ignore_status=False, debug=True) + domxml = virsh.dumpxml(vm_name).stdout.strip() + xtf_dom = xml_utils.XMLTreeFile(domxml) + snap_file_path = xtf_dom.find("devices/disk/source").get("file") + if os.path.exists(snap_file_path): + os.remove(snap_file_path) + else: + virsh.snapshot_create_as(vm_name, vm_s1, ignore_status=False, debug=True) + virsh.snapshot_revert(vm_name, vm_s1, ignore_status=False, debug=True) + virsh.snapshot_delete(vm_name, vm_s1, ignore_status=False, debug=True) def test_hotplug(vm, params, test):