QEMU_CAPS_DEVICE_NVDIMM validation is now being done inside qemuDomainDefValidateMemory(). Signed-off-by: Daniel Henrique Barboza <danielhb413@xxxxxxxxx> --- src/qemu/qemu_command.c | 5 ----- src/qemu/qemu_domain.c | 10 ++++++++++ tests/qemuxml2xmltest.c | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index e7365ba86a..25886bf49a 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -7180,11 +7180,6 @@ qemuBuildMachineCommandLine(virCommandPtr cmd, for (i = 0; i < def->nmems; i++) { if (def->mems[i]->model == VIR_DOMAIN_MEMORY_MODEL_NVDIMM) { - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_NVDIMM)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("nvdimm isn't supported by this QEMU binary")); - return -1; - } virBufferAddLit(&buf, ",nvdimm=on"); break; } diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index d62e13f26c..8eb0905f22 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -5021,6 +5021,7 @@ qemuDomainDefValidateMemory(const virDomainDef *def, { const long system_page_size = virGetSystemPageSizeKB(); const virDomainMemtune *mem = &def->mem; + size_t i; if (mem->nhugepages == 0) return 0; @@ -5066,6 +5067,15 @@ qemuDomainDefValidateMemory(const virDomainDef *def, return -1; } + for (i = 0; i < def->nmems; i++) { + if (def->mems[i]->model == VIR_DOMAIN_MEMORY_MODEL_NVDIMM && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_NVDIMM)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("nvdimm isn't supported by this QEMU binary")); + return -1; + } + } + return 0; } diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 4353c7a6b8..0e2933e13e 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -302,7 +302,7 @@ mymain(void) DO_TEST("hugepages-shared", NONE); DO_TEST("hugepages-memaccess", NONE); DO_TEST("hugepages-memaccess2", NONE); - DO_TEST("hugepages-nvdimm", NONE); + DO_TEST("hugepages-nvdimm", QEMU_CAPS_DEVICE_NVDIMM); DO_TEST("nosharepages", NONE); DO_TEST("restore-v2", NONE); DO_TEST("migrate", NONE); -- 2.23.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list