]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu_validate: Check capability for virtio-mem dynamicMemslots
authorMichal Privoznik <mprivozn@redhat.com>
Thu, 4 Jan 2024 10:04:51 +0000 (11:04 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 30 Jan 2024 09:44:36 +0000 (10:44 +0100)
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>
src/qemu/qemu_validate.c

index 01f65c0866ab4f7b75014370eaaae6bba23801ec..d3bea6513997c5dbabce94328b31d089600ebdae 100644 (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: