qemu_validate: Check capability for virtio-mem dynamicMemslots

The QEMU_CAPS_DEVICE_VIRTIO_MEM_PCI_DYNAMIC_MEMSLOTS reflects
whether QEMU is capable of .dynamic-memslots for virtio-mem.
Use it when validating domain configuration.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
Michal Privoznik 2024-01-04 11:04:51 +01:00
parent 497cab753b
commit 6be07af817

View File

@ -5066,6 +5066,13 @@ qemuValidateDomainDeviceDefMemory(virDomainMemoryDef *mem,
_("virtio-mem isn't supported by this QEMU binary"));
return -1;
}
if (mem->target.virtio_mem.dynamicMemslots == VIR_TRISTATE_BOOL_YES &&
!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_MEM_PCI_DYNAMIC_MEMSLOTS)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("virtio-mem does not support dynamicMemslots"));
return -1;
}
break;
case VIR_DOMAIN_MEMORY_MODEL_SGX_EPC: