On Thu, Feb 20, 2020 at 15:32:46 +0100, Ján Tomko wrote:
Reject unsupported configurations.
Signed-off-by: Ján Tomko <jtomko(a)redhat.com>
---
src/qemu/qemu_domain.c | 61 +++++++++++++++++++++++++++++++++++++++---
1 file changed, 58 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index c3fc3fed1c..7cb283123d 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -8266,10 +8266,44 @@ qemuDomainDeviceDefValidateIOMMU(const virDomainIOMMUDef *iommu,
return 0;
}
+static int
+qemuDomainDefValidateVirtioFSSharedMemory(const virDomainDef *def)
+{
+ size_t numa_nodes = virDomainNumaGetNodeCount(def->numa);
+ size_t i;
+
+ for (i = 0; i < numa_nodes; i++) {
This won't catch guests with no numa configured ...
+ virDomainMemoryAccess node_access =
+ virDomainNumaGetNodeMemoryAccessMode(def->numa, i);
+
+ switch (node_access) {
+ case VIR_DOMAIN_MEMORY_ACCESS_DEFAULT:
+ if (def->mem.access != VIR_DOMAIN_MEMORY_ACCESS_SHARED) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("virtiofs requires shared memory"));
... so this error won't be reported.
Also must all nodes have shared memory? Isn't one enough?
+ return -1;
+ }
+ break;
+ case VIR_DOMAIN_MEMORY_ACCESS_SHARED:
+ break;
+ case VIR_DOMAIN_MEMORY_ACCESS_PRIVATE:
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("virtiofs requires shared memory"));
+ return -1;
+
+ case VIR_DOMAIN_MEMORY_ACCESS_LAST:
+ default:
+ virReportEnumRangeError(virDomainMemoryAccess, node_access);
+ return -1;
+
+ }
+ }
+ return 0;
+}