...if a machine memory-backend using shared memory is configured for the guest. This is especially important for QEMU machine types that don't have NUMA but virtiofs support. An example snippet: <domain type='kvm'> <name>test</name> <memory unit='KiB'>2097152</memory> <memoryBacking> <access mode='shared'/> </memoryBacking> <devices> <filesystem type='mount' accessmode='passthrough'> <driver type='virtiofs'/> <source dir='/tmp/test'/> <target dir='coffee'/> </filesystem> ... </devices> ... </domain> and the corresponding QEMU command line: /usr/bin/qemu-system-s390x \ -machine s390-ccw-virtio-5.2,memory-backend=s390.ram \ -m 2048 \ -object memory-backend-file,id=s390.ram,mem-path=/var/lib/libvirt/qemu/ram/46-test/s390.ram,share=yes,size=2147483648 \ ... Signed-off-by: Marc Hartmayer <mhartmay@xxxxxxxxxxxxx> --- src/qemu/qemu_validate.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index 27e10d59fd25..bc3043bb3f0d 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -3470,14 +3470,19 @@ qemuValidateDomainDeviceDefGraphics(const virDomainGraphicsDef *graphics, static int -qemuValidateDomainDefVirtioFSSharedMemory(const virDomainDef *def) +qemuValidateDomainDefVirtioFSSharedMemory(const virDomainDef *def, + virQEMUCapsPtr qemuCaps) { + const char *defaultRAMId = virQEMUCapsGetMachineDefaultRAMid(qemuCaps, + def->virtType, + def->os.machine); size_t numa_nodes = virDomainNumaGetNodeCount(def->numa); size_t i; - if (numa_nodes == 0) { + if (numa_nodes == 0 && + !(defaultRAMId && def->mem.access == VIR_DOMAIN_MEMORY_ACCESS_SHARED)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("virtiofs requires one or more NUMA nodes")); + _("virtiofs requires shared memory")); return -1; } @@ -3591,7 +3596,7 @@ qemuValidateDomainDeviceDefFS(virDomainFSDefPtr fs, _("virtiofs does not support multidevs")); return -1; } - if (qemuValidateDomainDefVirtioFSSharedMemory(def) < 0) + if (qemuValidateDomainDefVirtioFSSharedMemory(def, qemuCaps) < 0) return -1; break; -- 2.25.4