qemu: command: move mem.nosharepages validation to qemu_domain.c

Move QEMU_CAPS_MEM_MERGE validation from qemuBuildMachineCommandLine()
to qemuDomainDefValidateMemory().

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
This commit is contained in:
Daniel Henrique Barboza 2019-12-09 20:15:07 -03:00 committed by Cole Robinson
parent 2628247f84
commit 96178e2238
2 changed files with 8 additions and 9 deletions

View File

@ -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))

View File

@ -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;
}