Signed-off-by: Daniel Henrique Barboza <danielhb413(a)gmail.com>
---
src/qemu/qemu_command.c | 5 -----
src/qemu/qemu_validate.c | 15 +++++++++++++++
tests/qemuxml2xmltest.c | 2 +-
3 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 34d57606f0..225d1d7491 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -7291,11 +7291,6 @@ qemuBuildNumaCommandLine(virQEMUDriverConfigPtr cfg,
if (rc == 0)
needBackend = true;
}
- } else if (needBackend) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("NUMA without specified memory backing is not "
- "supported with this QEMU binary"));
- goto cleanup;
}
if (!needBackend &&
diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index 7e6313b5c8..9bb7cddb40 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -701,6 +701,7 @@ qemuValidateDomainDefNuma(const virDomainDef *def,
bool hasMemoryCap = virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_MEMORY_RAM) ||
virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_MEMORY_FILE) ||
virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_MEMORY_MEMFD);
+ bool needBacking = false;
if (virDomainNumatuneHasPerNodeBinding(def->numa) && !hasMemoryCap) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
@@ -752,6 +753,20 @@ qemuValidateDomainDefNuma(const virDomainDef *def,
return -1;
}
+ if (virDomainNumaHasHMAT(def->numa) ||
+ !virQEMUCapsGetMachineNumaMemSupported(qemuCaps,
+ def->virtType,
+ def->os.machine)) {
+ needBacking = true;
+ }
+
+ if (needBacking && !hasMemoryCap) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("NUMA without specified memory backing is not "
+ "supported with this QEMU binary"));
+ return -1;
+ }
+
return 0;
}
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 6c551f18ab..93287d0a55 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -1141,7 +1141,7 @@ mymain(void)
DO_TEST("numatune-memnode-no-memory", QEMU_CAPS_OBJECT_MEMORY_FILE);
DO_TEST("numatune-distances", QEMU_CAPS_NUMA, QEMU_CAPS_NUMA_DIST);
DO_TEST("numatune-no-vcpu", QEMU_CAPS_NUMA);
- DO_TEST("numatune-hmat", QEMU_CAPS_NUMA_HMAT);
+ DO_TEST("numatune-hmat", QEMU_CAPS_NUMA_HMAT,
QEMU_CAPS_OBJECT_MEMORY_RAM);
DO_TEST("bios-nvram", NONE);
DO_TEST("bios-nvram-os-interleave", NONE);
--
2.26.2