Move QEMU_CAPS_MEM_MERGE validation from qemuBuildMachineCommandLine()
to qemuDomainDefValidateMemory().
Signed-off-by: Daniel Henrique Barboza <danielhb413(a)gmail.com>
---
src/qemu/qemu_command.c | 10 +---------
src/qemu/qemu_domain.c | 7 +++++++
2 files changed, 8 insertions(+), 9 deletions(-)
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 e25b439a39..d78c5904ff 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -5049,6 +5049,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;
}
--
2.23.0