qemu: command: Assume QEMU_CAPS_DEVICE when building memballoon args

This commit is contained in:
Peter Krempa 2016-04-06 14:24:39 +02:00
parent feffcc03a0
commit c1300176f7

View File

@ -3525,6 +3525,7 @@ qemuBuildMemballoonCommandLine(virCommandPtr cmd,
const virDomainDef *def,
virQEMUCapsPtr qemuCaps)
{
char *optstr;
/* QEMU changed its default behavior to not include the virtio balloon
* device. Explicitly request it to ensure it will be present.
*
@ -3543,18 +3544,14 @@ qemuBuildMemballoonCommandLine(virCommandPtr cmd,
virDomainMemballoonModelTypeToString(def->memballoon->model));
return -1;
}
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
char *optstr;
virCommandAddArg(cmd, "-device");
optstr = qemuBuildMemballoonDevStr(def, def->memballoon, qemuCaps);
if (!optstr)
return -1;
virCommandAddArg(cmd, optstr);
VIR_FREE(optstr);
} else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_BALLOON)) {
virCommandAddArgList(cmd, "-balloon", "virtio", NULL);
}
virCommandAddArg(cmd, "-device");
optstr = qemuBuildMemballoonDevStr(def, def->memballoon, qemuCaps);
if (!optstr)
return -1;
virCommandAddArg(cmd, optstr);
VIR_FREE(optstr);
}
return 0;
}