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