libvirt/SOURCES/libvirt-qemu_validate-Check-capability-for-virtio-mem-dynamicMemslots.patch

41 lines
1.6 KiB
Diff

From 9f35c04add8d64748671e76171683332bd454317 Mon Sep 17 00:00:00 2001
Message-ID: <9f35c04add8d64748671e76171683332bd454317.1707394627.git.jdenemar@redhat.com>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Thu, 4 Jan 2024 11:04:51 +0100
Subject: [PATCH] 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>
(cherry picked from commit 6be07af817e0a8d48613296af66873e62a73339a)
Resolves: https://issues.redhat.com/browse/RHEL-15316
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
src/qemu/qemu_validate.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index b22d3618fe..fe8f7ae8cc 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -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:
--
2.43.0