diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 12a9d47f44..a56f324af2 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -7120,16 +7120,8 @@ qemuBuildMachineCommandLine(virCommandPtr cmd, cfg->dumpGuestCore ? "on" : "off"); } - if (def->mem.nosharepages) { - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_MEM_MERGE)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("disable shared memory is not available " - "with this QEMU binary")); - return -1; - } - + if (def->mem.nosharepages) virBufferAddLit(&buf, ",mem-merge=off"); - } if (def->keywrap && !qemuAppendKeyWrapMachineParms(&buf, qemuCaps, def->keywrap)) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 328ce183b9..4bce3219e2 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -5180,6 +5180,13 @@ qemuDomainDefValidateMemory(const virDomainDef *def, return -1; } + if (mem->nosharepages && !virQEMUCapsGet(qemuCaps, QEMU_CAPS_MEM_MERGE)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("disable shared memory is not available " + "with this QEMU binary")); + return -1; + } + return 0; }