In preparation for adding support for '-overcommit cpu-pm=[on|off]',
add qemuBuildOvercommitCommandLine() to generate the '-overcommit'
commandline. Move the existing '-overcommit mem-lock=[on|off]'
generation code from qemuBuildMemCommandline() to this function.
Signed-off-by: Menno Lageman <menno.lageman@oracle.com>
---
src/qemu/qemu_command.c | 25 +++++++++++++++++++++----
1 file changed, 21 insertions(+), 4 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index f096e8f27e58..922456ec679e 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -7832,10 +7832,11 @@ qemuBuildMemCommandLine(virCommandPtr cmd,
qemuBuildMemPathStr(cfg, def, cmd, priv) < 0)
return -1;
- if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_OVERCOMMIT)) {
- virCommandAddArg(cmd, "-overcommit");
- virCommandAddArgFormat(cmd, "mem-lock=%s", def->mem.locked ? "on" : "off");
- } else {
+ /*
+ * '-overcommit mem-lock=on|off' is handled with other
+ * overcommit options later on.
+ */
+ if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_OVERCOMMIT)) {
virCommandAddArg(cmd, "-realtime");
virCommandAddArgFormat(cmd, "mlock=%s",
def->mem.locked ? "on" : "off");
@@ -7845,6 +7846,19 @@ qemuBuildMemCommandLine(virCommandPtr cmd,
}
+static int
+qemuBuildOvercommitCommandLine(virCommandPtr cmd,
+ const virDomainDef *def,
+ virQEMUCapsPtr qemuCaps)
+{
+ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_OVERCOMMIT)) {
+ virCommandAddArg(cmd, "-overcommit");
+ virCommandAddArgFormat(cmd, "mem-lock=%s", def->mem.locked ? "on" : "off");
+ }
+ return 0;
+}
+
+
static int
qemuBuildIOThreadCommandLine(virCommandPtr cmd,
const virDomainDef *def)
@@ -10657,6 +10671,9 @@ qemuBuildCommandLine(virQEMUDriverPtr driver,
if (qemuBuildMemCommandLine(cmd, cfg, def, qemuCaps, priv) < 0)
goto error;
+ if (qemuBuildOvercommitCommandLine(cmd, def, qemuCaps) < 0)
+ goto error;
+
if (qemuBuildSmpCommandLine(cmd, def) < 0)
goto error;
--
2.21.0
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
On Mon, Aug 19, 2019 at 10:32:24AM +0200, Menno Lageman wrote: >In preparation for adding support for '-overcommit cpu-pm=[on|off]', >add qemuBuildOvercommitCommandLine() to generate the '-overcommit' >commandline. Move the existing '-overcommit mem-lock=[on|off]' >generation code from qemuBuildMemCommandline() to this function. > I guess we could proclaim that -realtime mlock= also deals with overcommit and separate it into the same function, especially since the rest of the MemCommandLine does not depend on it (and we would touch def->mem.locked in the new Overcommit function anyway). Jano >Signed-off-by: Menno Lageman <menno.lageman@oracle.com> >--- > src/qemu/qemu_command.c | 25 +++++++++++++++++++++---- > 1 file changed, 21 insertions(+), 4 deletions(-) > -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
© 2016 - 2026 Red Hat, Inc.