diff --git a/qemu/tests/hotplug_virtio_mem.py b/qemu/tests/hotplug_virtio_mem.py index baa1d276fb2..cf1509551a2 100644 --- a/qemu/tests/hotplug_virtio_mem.py +++ b/qemu/tests/hotplug_virtio_mem.py @@ -2,6 +2,7 @@ from virttest import error_context +from virttest.qemu_monitor import QMPCmdError from virttest.utils_misc import normalize_data_size from virttest.utils_test.qemu import MemoryHotplugTest from provider import virtio_mem_utils @@ -53,4 +54,13 @@ def run(test, params, env): threshold, vm, test) virtio_mem_utils.check_numa_plugged_mem(node_id, requested_size, threshold, vm, test) + try: + hotplug_test.unplug_memory(vm, target_mem) + except QMPCmdError: + test.log.info("virtio-mem device cannot get unplugged while 'size' != '0'") + + vm.monitor.qom_set(device_id, "requested-size", 0) + time.sleep(10) + hotplug_test.unplug_memory(vm, target_mem) + session.close()