[libvirt] [PATCH 0/8] qemu: Fix current ballooned size after memory hot(un)plug

Clean up some of the memory balloon code and fix the calculation of size after hotplug. Peter Krempa (8): qemu: command: Assume QEMU_CAPS_DEVICE when building memballoon args qemu: caps: Deprecate QEMU_CAPS_BALLOON qemu: command: Drop obsolete comment qemu: command: Refactor memballoon command line formatting qemu: domain: Add helper to determine presence of memory baloon qemu: driver: Reuse qemuDomainGetMonitor in qemuDomainMemoryStats qemu: process: Simplify condition in qemuProcessRefreshBalloonState qemu: hotplug: Properly recalculate/reload balloon size after hot(un)plug src/qemu/qemu_capabilities.c | 3 - src/qemu/qemu_capabilities.h | 2 +- src/qemu/qemu_command.c | 83 +++++++++------------------ src/qemu/qemu_command.h | 4 -- src/qemu/qemu_domain.c | 11 +++- src/qemu/qemu_domain.h | 1 + src/qemu/qemu_driver.c | 16 ++---- src/qemu/qemu_hotplug.c | 15 ++--- src/qemu/qemu_process.c | 16 ++---- src/qemu/qemu_process.h | 4 ++ tests/qemucapabilitiesdata/caps_1.2.2-1.caps | 1 - tests/qemucapabilitiesdata/caps_1.3.1-1.caps | 1 - tests/qemucapabilitiesdata/caps_1.4.2-1.caps | 1 - tests/qemucapabilitiesdata/caps_1.5.3-1.caps | 1 - tests/qemucapabilitiesdata/caps_1.6.0-1.caps | 1 - tests/qemucapabilitiesdata/caps_1.6.50-1.caps | 1 - tests/qemucapabilitiesdata/caps_2.1.1-1.caps | 1 - tests/qemucapabilitiesdata/caps_2.4.0-1.caps | 1 - tests/qemucapabilitiesdata/caps_2.5.0-1.caps | 1 - tests/qemucapabilitiesdata/caps_2.6.0-1.caps | 1 - tests/qemuhelptest.c | 8 --- 21 files changed, 59 insertions(+), 114 deletions(-) -- 2.8.0

--- src/qemu/qemu_command.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index a6afaec..bcd2408 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3452,6 +3452,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. * @@ -3470,18 +3471,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; } -- 2.8.0

The flag is now unused and all qemus supported by libvirt already support it. --- src/qemu/qemu_capabilities.c | 3 --- src/qemu/qemu_capabilities.h | 2 +- tests/qemucapabilitiesdata/caps_1.2.2-1.caps | 1 - tests/qemucapabilitiesdata/caps_1.3.1-1.caps | 1 - tests/qemucapabilitiesdata/caps_1.4.2-1.caps | 1 - tests/qemucapabilitiesdata/caps_1.5.3-1.caps | 1 - tests/qemucapabilitiesdata/caps_1.6.0-1.caps | 1 - tests/qemucapabilitiesdata/caps_1.6.50-1.caps | 1 - tests/qemucapabilitiesdata/caps_2.1.1-1.caps | 1 - tests/qemucapabilitiesdata/caps_2.4.0-1.caps | 1 - tests/qemucapabilitiesdata/caps_2.5.0-1.caps | 1 - tests/qemucapabilitiesdata/caps_2.6.0-1.caps | 1 - tests/qemuhelptest.c | 8 -------- 13 files changed, 1 insertion(+), 22 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 2823843..b0c741e 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -1163,8 +1163,6 @@ virQEMUCapsComputeCmdFlags(const char *help, if (strstr(help, "-chardev spiceport")) virQEMUCapsSet(qemuCaps, QEMU_CAPS_CHARDEV_SPICEPORT); } - if (strstr(help, "-balloon")) - virQEMUCapsSet(qemuCaps, QEMU_CAPS_BALLOON); if (strstr(help, "-device")) { virQEMUCapsSet(qemuCaps, QEMU_CAPS_DEVICE); /* @@ -3226,7 +3224,6 @@ virQEMUCapsInitQMPBasic(virQEMUCapsPtr qemuCaps) virQEMUCapsSet(qemuCaps, QEMU_CAPS_DRIVE_SERIAL); virQEMUCapsSet(qemuCaps, QEMU_CAPS_CHARDEV); virQEMUCapsSet(qemuCaps, QEMU_CAPS_MONITOR_JSON); - virQEMUCapsSet(qemuCaps, QEMU_CAPS_BALLOON); virQEMUCapsSet(qemuCaps, QEMU_CAPS_DEVICE); virQEMUCapsSet(qemuCaps, QEMU_CAPS_SDL); virQEMUCapsSet(qemuCaps, QEMU_CAPS_SMP_TOPOLOGY); diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index caf3d1b..3047d1b 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -81,7 +81,7 @@ typedef enum { QEMU_CAPS_MONITOR_JSON, /* JSON mode for monitor */ /* 25 */ - QEMU_CAPS_BALLOON, /* -balloon available */ + X_QEMU_CAPS_BALLOON, /* -balloon available */ QEMU_CAPS_DEVICE, /* Is the new -device arg available */ QEMU_CAPS_SDL, /* Is the new -sdl arg available */ QEMU_CAPS_SMP_TOPOLOGY, /* -smp has sockets/cores/threads */ diff --git a/tests/qemucapabilitiesdata/caps_1.2.2-1.caps b/tests/qemucapabilitiesdata/caps_1.2.2-1.caps index 2e452ea..9ea36a6 100644 --- a/tests/qemucapabilitiesdata/caps_1.2.2-1.caps +++ b/tests/qemucapabilitiesdata/caps_1.2.2-1.caps @@ -4,7 +4,6 @@ <flag name='chardev'/> <flag name='enable-kvm'/> <flag name='monitor-json'/> - <flag name='balloon'/> <flag name='device'/> <flag name='sdl'/> <flag name='smp-topology'/> diff --git a/tests/qemucapabilitiesdata/caps_1.3.1-1.caps b/tests/qemucapabilitiesdata/caps_1.3.1-1.caps index 5ad56aa..8c237ef 100644 --- a/tests/qemucapabilitiesdata/caps_1.3.1-1.caps +++ b/tests/qemucapabilitiesdata/caps_1.3.1-1.caps @@ -4,7 +4,6 @@ <flag name='chardev'/> <flag name='enable-kvm'/> <flag name='monitor-json'/> - <flag name='balloon'/> <flag name='device'/> <flag name='sdl'/> <flag name='smp-topology'/> diff --git a/tests/qemucapabilitiesdata/caps_1.4.2-1.caps b/tests/qemucapabilitiesdata/caps_1.4.2-1.caps index d0341fd..fe98a57 100644 --- a/tests/qemucapabilitiesdata/caps_1.4.2-1.caps +++ b/tests/qemucapabilitiesdata/caps_1.4.2-1.caps @@ -4,7 +4,6 @@ <flag name='chardev'/> <flag name='enable-kvm'/> <flag name='monitor-json'/> - <flag name='balloon'/> <flag name='device'/> <flag name='sdl'/> <flag name='smp-topology'/> diff --git a/tests/qemucapabilitiesdata/caps_1.5.3-1.caps b/tests/qemucapabilitiesdata/caps_1.5.3-1.caps index 93ea687..6e9ec3e 100644 --- a/tests/qemucapabilitiesdata/caps_1.5.3-1.caps +++ b/tests/qemucapabilitiesdata/caps_1.5.3-1.caps @@ -4,7 +4,6 @@ <flag name='chardev'/> <flag name='enable-kvm'/> <flag name='monitor-json'/> - <flag name='balloon'/> <flag name='device'/> <flag name='sdl'/> <flag name='smp-topology'/> diff --git a/tests/qemucapabilitiesdata/caps_1.6.0-1.caps b/tests/qemucapabilitiesdata/caps_1.6.0-1.caps index c25b076..da371a4 100644 --- a/tests/qemucapabilitiesdata/caps_1.6.0-1.caps +++ b/tests/qemucapabilitiesdata/caps_1.6.0-1.caps @@ -4,7 +4,6 @@ <flag name='chardev'/> <flag name='enable-kvm'/> <flag name='monitor-json'/> - <flag name='balloon'/> <flag name='device'/> <flag name='sdl'/> <flag name='smp-topology'/> diff --git a/tests/qemucapabilitiesdata/caps_1.6.50-1.caps b/tests/qemucapabilitiesdata/caps_1.6.50-1.caps index 30b70e9..1e2fb6a 100644 --- a/tests/qemucapabilitiesdata/caps_1.6.50-1.caps +++ b/tests/qemucapabilitiesdata/caps_1.6.50-1.caps @@ -4,7 +4,6 @@ <flag name='chardev'/> <flag name='enable-kvm'/> <flag name='monitor-json'/> - <flag name='balloon'/> <flag name='device'/> <flag name='sdl'/> <flag name='smp-topology'/> diff --git a/tests/qemucapabilitiesdata/caps_2.1.1-1.caps b/tests/qemucapabilitiesdata/caps_2.1.1-1.caps index 59d0323..8175743 100644 --- a/tests/qemucapabilitiesdata/caps_2.1.1-1.caps +++ b/tests/qemucapabilitiesdata/caps_2.1.1-1.caps @@ -4,7 +4,6 @@ <flag name='chardev'/> <flag name='enable-kvm'/> <flag name='monitor-json'/> - <flag name='balloon'/> <flag name='device'/> <flag name='sdl'/> <flag name='smp-topology'/> diff --git a/tests/qemucapabilitiesdata/caps_2.4.0-1.caps b/tests/qemucapabilitiesdata/caps_2.4.0-1.caps index efbf9af..883bf50 100644 --- a/tests/qemucapabilitiesdata/caps_2.4.0-1.caps +++ b/tests/qemucapabilitiesdata/caps_2.4.0-1.caps @@ -4,7 +4,6 @@ <flag name='chardev'/> <flag name='enable-kvm'/> <flag name='monitor-json'/> - <flag name='balloon'/> <flag name='device'/> <flag name='sdl'/> <flag name='smp-topology'/> diff --git a/tests/qemucapabilitiesdata/caps_2.5.0-1.caps b/tests/qemucapabilitiesdata/caps_2.5.0-1.caps index 5fd3bce..2b73b73 100644 --- a/tests/qemucapabilitiesdata/caps_2.5.0-1.caps +++ b/tests/qemucapabilitiesdata/caps_2.5.0-1.caps @@ -4,7 +4,6 @@ <flag name='chardev'/> <flag name='enable-kvm'/> <flag name='monitor-json'/> - <flag name='balloon'/> <flag name='device'/> <flag name='sdl'/> <flag name='smp-topology'/> diff --git a/tests/qemucapabilitiesdata/caps_2.6.0-1.caps b/tests/qemucapabilitiesdata/caps_2.6.0-1.caps index 549759c..f244c76 100644 --- a/tests/qemucapabilitiesdata/caps_2.6.0-1.caps +++ b/tests/qemucapabilitiesdata/caps_2.6.0-1.caps @@ -4,7 +4,6 @@ <flag name='chardev'/> <flag name='enable-kvm'/> <flag name='monitor-json'/> - <flag name='balloon'/> <flag name='device'/> <flag name='sdl'/> <flag name='smp-topology'/> diff --git a/tests/qemuhelptest.c b/tests/qemuhelptest.c index 35fc9c7..26455d5 100644 --- a/tests/qemuhelptest.c +++ b/tests/qemuhelptest.c @@ -157,7 +157,6 @@ mymain(void) QEMU_CAPS_ENABLE_KVM, QEMU_CAPS_SDL, QEMU_CAPS_CHARDEV, - QEMU_CAPS_BALLOON, QEMU_CAPS_DEVICE, QEMU_CAPS_SMP_TOPOLOGY, QEMU_CAPS_RTC, @@ -183,7 +182,6 @@ mymain(void) QEMU_CAPS_CHARDEV, QEMU_CAPS_ENABLE_KVM, QEMU_CAPS_MONITOR_JSON, - QEMU_CAPS_BALLOON, QEMU_CAPS_DEVICE, QEMU_CAPS_SMP_TOPOLOGY, QEMU_CAPS_NETDEV, @@ -231,7 +229,6 @@ mymain(void) QEMU_CAPS_MEM_PATH, QEMU_CAPS_SDL, QEMU_CAPS_CHARDEV, - QEMU_CAPS_BALLOON, QEMU_CAPS_DEVICE, QEMU_CAPS_SMP_TOPOLOGY, QEMU_CAPS_RTC, @@ -263,7 +260,6 @@ mymain(void) QEMU_CAPS_CHARDEV, QEMU_CAPS_ENABLE_KVM, QEMU_CAPS_MONITOR_JSON, - QEMU_CAPS_BALLOON, QEMU_CAPS_DEVICE, QEMU_CAPS_SMP_TOPOLOGY, QEMU_CAPS_NETDEV, @@ -321,7 +317,6 @@ mymain(void) QEMU_CAPS_CHARDEV, QEMU_CAPS_ENABLE_KVM, QEMU_CAPS_MONITOR_JSON, - QEMU_CAPS_BALLOON, QEMU_CAPS_DEVICE, QEMU_CAPS_SMP_TOPOLOGY, QEMU_CAPS_NETDEV, @@ -376,7 +371,6 @@ mymain(void) QEMU_CAPS_MEM_PATH, QEMU_CAPS_CHARDEV, QEMU_CAPS_ENABLE_KVM, - QEMU_CAPS_BALLOON, QEMU_CAPS_MONITOR_JSON, QEMU_CAPS_DEVICE, QEMU_CAPS_SMP_TOPOLOGY, @@ -440,7 +434,6 @@ mymain(void) QEMU_CAPS_CHARDEV, QEMU_CAPS_ENABLE_KVM, QEMU_CAPS_MONITOR_JSON, - QEMU_CAPS_BALLOON, QEMU_CAPS_DEVICE, QEMU_CAPS_SMP_TOPOLOGY, QEMU_CAPS_NETDEV, @@ -519,7 +512,6 @@ mymain(void) QEMU_CAPS_CHARDEV, QEMU_CAPS_ENABLE_KVM, QEMU_CAPS_MONITOR_JSON, - QEMU_CAPS_BALLOON, QEMU_CAPS_DEVICE, QEMU_CAPS_SMP_TOPOLOGY, QEMU_CAPS_NETDEV, -- 2.8.0

The change that made qemu not add the memballoon by default happened prior to 0.12.0. Additionaly the comment was misleading due to the code that was added below. Since we always need to add a balloon on the commandline drop the comment. --- src/qemu/qemu_command.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index bcd2408..5843516 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3453,12 +3453,7 @@ qemuBuildMemballoonCommandLine(virCommandPtr cmd, 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. - * - * NB: Earlier we declared that VirtIO balloon will always be in - * slot 0x3 on bus 0x0 - */ + if (STREQLEN(def->os.machine, "s390-virtio", 10) && virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_S390) && def->memballoon) def->memballoon->model = VIR_DOMAIN_MEMBALLOON_MODEL_NONE; -- 2.8.0

Now that there is just one format of the memory balloon command line used the code can be merged into a single function. Additionally with some tweaks to the control flow the code is easier to read. --- src/qemu/qemu_command.c | 76 +++++++++++++++++++------------------------------ src/qemu/qemu_command.h | 4 --- 2 files changed, 29 insertions(+), 51 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 5843516..a2448bf 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3397,14 +3397,29 @@ qemuBuildWatchdogCommandLine(virCommandPtr cmd, } -char * -qemuBuildMemballoonDevStr(const virDomainDef *def, - virDomainMemballoonDefPtr dev, - virQEMUCapsPtr qemuCaps) +static int +qemuBuildMemballoonCommandLine(virCommandPtr cmd, + const virDomainDef *def, + virQEMUCapsPtr qemuCaps) { virBuffer buf = VIR_BUFFER_INITIALIZER; - switch (dev->info.type) { + if (STREQLEN(def->os.machine, "s390-virtio", 10) && + virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_S390) && def->memballoon) + def->memballoon->model = VIR_DOMAIN_MEMBALLOON_MODEL_NONE; + + if (!def->memballoon || + def->memballoon->model == VIR_DOMAIN_MEMBALLOON_MODEL_NONE) + return 0; + + if (def->memballoon->model != VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Memory balloon device type '%s' is not supported by this version of qemu"), + virDomainMemballoonModelTypeToString(def->memballoon->model)); + return -1; + } + + switch (def->memballoon->info.type) { case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI: virBufferAddLit(&buf, "virtio-balloon-pci"); break; @@ -3417,15 +3432,15 @@ qemuBuildMemballoonDevStr(const virDomainDef *def, default: virReportError(VIR_ERR_XML_ERROR, _("memballoon unsupported with address type '%s'"), - virDomainDeviceAddressTypeToString(dev->info.type)); + virDomainDeviceAddressTypeToString(def->memballoon->info.type)); goto error; } - virBufferAsprintf(&buf, ",id=%s", dev->info.alias); - if (qemuBuildDeviceAddressStr(&buf, def, &dev->info, qemuCaps) < 0) + virBufferAsprintf(&buf, ",id=%s", def->memballoon->info.alias); + if (qemuBuildDeviceAddressStr(&buf, def, &def->memballoon->info, qemuCaps) < 0) goto error; - if (dev->autodeflate != VIR_TRISTATE_SWITCH_ABSENT) { + if (def->memballoon->autodeflate != VIR_TRISTATE_SWITCH_ABSENT) { if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_BALLOON_AUTODEFLATE)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("deflate-on-oom is not supported by this QEMU binary")); @@ -3433,49 +3448,16 @@ qemuBuildMemballoonDevStr(const virDomainDef *def, } virBufferAsprintf(&buf, ",deflate-on-oom=%s", - virTristateSwitchTypeToString(dev->autodeflate)); + virTristateSwitchTypeToString(def->memballoon->autodeflate)); } - if (virBufferCheckError(&buf) < 0) - goto error; - - return virBufferContentAndReset(&buf); + virCommandAddArg(cmd, "-device"); + virCommandAddArgBuffer(cmd, &buf); + return 0; error: virBufferFreeAndReset(&buf); - return NULL; -} - - -static int -qemuBuildMemballoonCommandLine(virCommandPtr cmd, - const virDomainDef *def, - virQEMUCapsPtr qemuCaps) -{ - char *optstr; - - if (STREQLEN(def->os.machine, "s390-virtio", 10) && - virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_S390) && def->memballoon) - def->memballoon->model = VIR_DOMAIN_MEMBALLOON_MODEL_NONE; - - if (def->memballoon && - def->memballoon->model != VIR_DOMAIN_MEMBALLOON_MODEL_NONE) { - if (def->memballoon->model != VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Memory balloon device type '%s' is not supported by this version of qemu"), - virDomainMemballoonModelTypeToString(def->memballoon->model)); - return -1; - } - - virCommandAddArg(cmd, "-device"); - - optstr = qemuBuildMemballoonDevStr(def, def->memballoon, qemuCaps); - if (!optstr) - return -1; - virCommandAddArg(cmd, optstr); - VIR_FREE(optstr); - } - return 0; + return -1; } diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h index a3e6a00..3e8ccd8 100644 --- a/src/qemu/qemu_command.h +++ b/src/qemu/qemu_command.h @@ -130,10 +130,6 @@ char *qemuBuildControllerDevStr(const virDomainDef *domainDef, virQEMUCapsPtr qemuCaps, int *nusbcontroller); -char *qemuBuildMemballoonDevStr(const virDomainDef *domainDef, - virDomainMemballoonDefPtr dev, - virQEMUCapsPtr qemuCaps); - int qemuBuildMemoryBackendStr(unsigned long long size, unsigned long long pagesize, int guestNode, -- 2.8.0

--- src/qemu/qemu_command.c | 3 +-- src/qemu/qemu_domain.c | 11 +++++++++-- src/qemu/qemu_domain.h | 1 + src/qemu/qemu_driver.c | 12 ++++-------- src/qemu/qemu_process.c | 9 +++------ 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index a2448bf..1518a53 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3408,8 +3408,7 @@ qemuBuildMemballoonCommandLine(virCommandPtr cmd, virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_S390) && def->memballoon) def->memballoon->model = VIR_DOMAIN_MEMBALLOON_MODEL_NONE; - if (!def->memballoon || - def->memballoon->model == VIR_DOMAIN_MEMBALLOON_MODEL_NONE) + if (!qemuDomainDefHasMemballoon(def)) return 0; if (def->memballoon->model != VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO) { diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index f38b0f3..c13acd1 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -4218,6 +4218,14 @@ qemuDomainMachineHasBuiltinIDE(const virDomainDef *def) } +bool +qemuDomainDefHasMemballoon(const virDomainDef *def) +{ + return def->memballoon && + def->memballoon->model != VIR_DOMAIN_MEMBALLOON_MODEL_NONE; +} + + /** * qemuDomainUpdateCurrentMemorySize: * @@ -4242,8 +4250,7 @@ qemuDomainUpdateCurrentMemorySize(virQEMUDriverPtr driver, /* if no balloning is available, the current size equals to the current * full memory size */ - if (!vm->def->memballoon || - vm->def->memballoon->model == VIR_DOMAIN_MEMBALLOON_MODEL_NONE) { + if (!qemuDomainDefHasMemballoon(vm->def)) { vm->def->mem.cur_balloon = virDomainDefGetMemoryActual(vm->def); return 0; } diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index 54d7bd7..2992214 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -516,6 +516,7 @@ bool qemuDomainHasBlockjob(virDomainObjPtr vm, bool copy_only) int qemuDomainAlignMemorySizes(virDomainDefPtr def); void qemuDomainMemoryDeviceAlignSize(virDomainDefPtr def, virDomainMemoryDefPtr mem); +bool qemuDomainDefHasMemballoon(const virDomainDef *def); virDomainChrDefPtr qemuFindAgentConfig(virDomainDefPtr def); diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index eaabe58..a00268b 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -2505,8 +2505,7 @@ static int qemuDomainSetMemoryStatsPeriod(virDomainPtr dom, int period, priv = vm->privateData; if (def) { - if (!def->memballoon || - def->memballoon->model != VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO) { + if (!qemuDomainDefHasMemballoon(def)) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Memory balloon model must be virtio to set the" " collection period")); @@ -2529,8 +2528,7 @@ static int qemuDomainSetMemoryStatsPeriod(virDomainPtr dom, int period, } if (persistentDef) { - if (!persistentDef->memballoon || - persistentDef->memballoon->model != VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO) { + if (!qemuDomainDefHasMemballoon(persistentDef)) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Memory balloon model must be virtio to set the" " collection period")); @@ -11495,8 +11493,7 @@ qemuDomainMemoryStats(virDomainPtr dom, goto endjob; } - if (vm->def->memballoon && - vm->def->memballoon->model == VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO) { + if (qemuDomainDefHasMemballoon(vm->def)) { priv = vm->privateData; qemuDomainObjEnterMonitor(driver, vm); ret = qemuMonitorGetMemoryStats(priv->mon, stats, nr_stats); @@ -19061,8 +19058,7 @@ qemuDomainGetStatsBalloon(virQEMUDriverPtr driver ATTRIBUTE_UNUSED, unsigned long long cur_balloon = 0; int err = 0; - if (dom->def->memballoon && - dom->def->memballoon->model == VIR_DOMAIN_MEMBALLOON_MODEL_NONE) { + if (!qemuDomainDefHasMemballoon(dom->def)) { cur_balloon = virDomainDefGetMemoryActual(dom->def); } else if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BALLOON_EVENT)) { cur_balloon = dom->def->mem.cur_balloon; diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index d9dca74..4911c1d 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -1933,8 +1933,7 @@ qemuProcessRefreshBalloonState(virQEMUDriverPtr driver, /* if no ballooning is available, the current size equals to the current * full memory size */ - if (!vm->def->memballoon || - vm->def->memballoon->model == VIR_DOMAIN_MEMBALLOON_MODEL_NONE) { + if (!qemuDomainDefHasMemballoon(vm->def)) { vm->def->mem.cur_balloon = virDomainDefGetMemoryActual(vm->def); return 0; } @@ -4382,8 +4381,7 @@ qemuProcessSetupBalloon(virQEMUDriverPtr driver, int period; int ret = -1; - if (!vm->def->memballoon || - vm->def->memballoon->model == VIR_DOMAIN_MEMBALLOON_MODEL_NONE) + if (!qemuDomainDefHasMemballoon(vm->def)) return 0; period = vm->def->memballoon->period; @@ -6237,8 +6235,7 @@ int qemuProcessAttach(virConnectPtr conn ATTRIBUTE_UNUSED, if (running) { virDomainObjSetState(vm, VIR_DOMAIN_RUNNING, VIR_DOMAIN_RUNNING_UNPAUSED); - if (vm->def->memballoon && - vm->def->memballoon->model == VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO && + if (qemuDomainDefHasMemballoon(vm->def) && vm->def->memballoon->period) { qemuDomainObjEnterMonitor(driver, vm); qemuMonitorSetMemoryStatsPeriod(priv->mon, -- 2.8.0

On 04/06/2016 12:02 PM, Peter Krempa wrote:
--- src/qemu/qemu_command.c | 3 +-- src/qemu/qemu_domain.c | 11 +++++++++-- src/qemu/qemu_domain.h | 1 + src/qemu/qemu_driver.c | 12 ++++-------- src/qemu/qemu_process.c | 9 +++------ 5 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index a2448bf..1518a53 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3408,8 +3408,7 @@ qemuBuildMemballoonCommandLine(virCommandPtr cmd, virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_S390) && def->memballoon) def->memballoon->model = VIR_DOMAIN_MEMBALLOON_MODEL_NONE;
- if (!def->memballoon || - def->memballoon->model == VIR_DOMAIN_MEMBALLOON_MODEL_NONE) + if (!qemuDomainDefHasMemballoon(def)) return 0;
if (def->memballoon->model != VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO) { diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index f38b0f3..c13acd1 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -4218,6 +4218,14 @@ qemuDomainMachineHasBuiltinIDE(const virDomainDef *def) }
+bool +qemuDomainDefHasMemballoon(const virDomainDef *def) +{ + return def->memballoon && + def->memballoon->model != VIR_DOMAIN_MEMBALLOON_MODEL_NONE;
I guess I would think would be if balloon and model == MODEL_VIRTIO I find it easier to read absolutes rather than considering alternatives to the != check... in this case that's only MODEL_XEN which yes should never happen, but with the && at least there's no question...
+} + + /** * qemuDomainUpdateCurrentMemorySize: * @@ -4242,8 +4250,7 @@ qemuDomainUpdateCurrentMemorySize(virQEMUDriverPtr driver,
/* if no balloning is available, the current size equals to the current * full memory size */ - if (!vm->def->memballoon || - vm->def->memballoon->model == VIR_DOMAIN_MEMBALLOON_MODEL_NONE) { + if (!qemuDomainDefHasMemballoon(vm->def)) { vm->def->mem.cur_balloon = virDomainDefGetMemoryActual(vm->def); return 0; } diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index 54d7bd7..2992214 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -516,6 +516,7 @@ bool qemuDomainHasBlockjob(virDomainObjPtr vm, bool copy_only) int qemuDomainAlignMemorySizes(virDomainDefPtr def); void qemuDomainMemoryDeviceAlignSize(virDomainDefPtr def, virDomainMemoryDefPtr mem); +bool qemuDomainDefHasMemballoon(const virDomainDef *def);
virDomainChrDefPtr qemuFindAgentConfig(virDomainDefPtr def);
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index eaabe58..a00268b 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -2505,8 +2505,7 @@ static int qemuDomainSetMemoryStatsPeriod(virDomainPtr dom, int period, priv = vm->privateData;
if (def) { - if (!def->memballoon || - def->memballoon->model != VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO) {
This is what I was thinking - either this construct or the corollary balloon && model == VIRTIO.
+ if (!qemuDomainDefHasMemballoon(def)) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Memory balloon model must be virtio to set the" " collection period")); @@ -2529,8 +2528,7 @@ static int qemuDomainSetMemoryStatsPeriod(virDomainPtr dom, int period, }
if (persistentDef) { - if (!persistentDef->memballoon || - persistentDef->memballoon->model != VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO) { + if (!qemuDomainDefHasMemballoon(persistentDef)) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Memory balloon model must be virtio to set the" " collection period")); @@ -11495,8 +11493,7 @@ qemuDomainMemoryStats(virDomainPtr dom, goto endjob; }
- if (vm->def->memballoon && - vm->def->memballoon->model == VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO) { + if (qemuDomainDefHasMemballoon(vm->def)) { priv = vm->privateData; qemuDomainObjEnterMonitor(driver, vm); ret = qemuMonitorGetMemoryStats(priv->mon, stats, nr_stats); @@ -19061,8 +19058,7 @@ qemuDomainGetStatsBalloon(virQEMUDriverPtr driver ATTRIBUTE_UNUSED, unsigned long long cur_balloon = 0; int err = 0;
- if (dom->def->memballoon && - dom->def->memballoon->model == VIR_DOMAIN_MEMBALLOON_MODEL_NONE) { + if (!qemuDomainDefHasMemballoon(dom->def)) {
Ugh.. the ugly duckling This changes the statement from if we have a model=NONE memballoon to we have a memballoon with a model that's not NONE. Double negatives. I think the logic has the right thought, but would be perhaps clearer in my mind with the adjusted logic in the common function. I think this is ACK-able just want get your thoughts on the logic for the helper... John
cur_balloon = virDomainDefGetMemoryActual(dom->def); } else if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BALLOON_EVENT)) { cur_balloon = dom->def->mem.cur_balloon; diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index d9dca74..4911c1d 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -1933,8 +1933,7 @@ qemuProcessRefreshBalloonState(virQEMUDriverPtr driver,
/* if no ballooning is available, the current size equals to the current * full memory size */ - if (!vm->def->memballoon || - vm->def->memballoon->model == VIR_DOMAIN_MEMBALLOON_MODEL_NONE) { + if (!qemuDomainDefHasMemballoon(vm->def)) { vm->def->mem.cur_balloon = virDomainDefGetMemoryActual(vm->def); return 0; } @@ -4382,8 +4381,7 @@ qemuProcessSetupBalloon(virQEMUDriverPtr driver, int period; int ret = -1;
- if (!vm->def->memballoon || - vm->def->memballoon->model == VIR_DOMAIN_MEMBALLOON_MODEL_NONE) + if (!qemuDomainDefHasMemballoon(vm->def)) return 0;
period = vm->def->memballoon->period; @@ -6237,8 +6235,7 @@ int qemuProcessAttach(virConnectPtr conn ATTRIBUTE_UNUSED, if (running) { virDomainObjSetState(vm, VIR_DOMAIN_RUNNING, VIR_DOMAIN_RUNNING_UNPAUSED); - if (vm->def->memballoon && - vm->def->memballoon->model == VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO && + if (qemuDomainDefHasMemballoon(vm->def) && vm->def->memballoon->period) { qemuDomainObjEnterMonitor(driver, vm); qemuMonitorSetMemoryStatsPeriod(priv->mon,

On Thu, Apr 14, 2016 at 14:35:08 -0400, John Ferlan wrote:
On 04/06/2016 12:02 PM, Peter Krempa wrote:
--- src/qemu/qemu_command.c | 3 +-- src/qemu/qemu_domain.c | 11 +++++++++-- src/qemu/qemu_domain.h | 1 + src/qemu/qemu_driver.c | 12 ++++-------- src/qemu/qemu_process.c | 9 +++------ 5 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index a2448bf..1518a53 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3408,8 +3408,7 @@ qemuBuildMemballoonCommandLine(virCommandPtr cmd, virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_S390) && def->memballoon) def->memballoon->model = VIR_DOMAIN_MEMBALLOON_MODEL_NONE;
- if (!def->memballoon || - def->memballoon->model == VIR_DOMAIN_MEMBALLOON_MODEL_NONE) + if (!qemuDomainDefHasMemballoon(def)) return 0;
if (def->memballoon->model != VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO) { diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index f38b0f3..c13acd1 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -4218,6 +4218,14 @@ qemuDomainMachineHasBuiltinIDE(const virDomainDef *def) }
+bool +qemuDomainDefHasMemballoon(const virDomainDef *def) +{ + return def->memballoon && + def->memballoon->model != VIR_DOMAIN_MEMBALLOON_MODEL_NONE;
I guess I would think would be if balloon and model == MODEL_VIRTIO
I find it easier to read absolutes rather than considering alternatives to the != check... in this case that's only MODEL_XEN which yes should never happen, but with the && at least there's no question...
So there are two things here: 1) the intented purpose is to return true if the VM has a memballoon 2) the code is not qemu specific in the end As a result of those, I'll move this to src/conf/domain_conf.c ... and ...
+} + + /** * qemuDomainUpdateCurrentMemorySize: * @@ -4242,8 +4250,7 @@ qemuDomainUpdateCurrentMemorySize(virQEMUDriverPtr driver,
/* if no balloning is available, the current size equals to the current * full memory size */ - if (!vm->def->memballoon || - vm->def->memballoon->model == VIR_DOMAIN_MEMBALLOON_MODEL_NONE) { + if (!qemuDomainDefHasMemballoon(vm->def)) { vm->def->mem.cur_balloon = virDomainDefGetMemoryActual(vm->def); return 0; } diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index 54d7bd7..2992214 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -516,6 +516,7 @@ bool qemuDomainHasBlockjob(virDomainObjPtr vm, bool copy_only) int qemuDomainAlignMemorySizes(virDomainDefPtr def); void qemuDomainMemoryDeviceAlignSize(virDomainDefPtr def, virDomainMemoryDefPtr mem); +bool qemuDomainDefHasMemballoon(const virDomainDef *def);
virDomainChrDefPtr qemuFindAgentConfig(virDomainDefPtr def);
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index eaabe58..a00268b 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -2505,8 +2505,7 @@ static int qemuDomainSetMemoryStatsPeriod(virDomainPtr dom, int period, priv = vm->privateData;
if (def) { - if (!def->memballoon || - def->memballoon->model != VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO) {
This is what I was thinking - either this construct or the corollary balloon && model == VIRTIO.
... drop these, since I don't really want to bother justyfing these ...
+ if (!qemuDomainDefHasMemballoon(def)) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Memory balloon model must be virtio to set the" " collection period")); @@ -2529,8 +2528,7 @@ static int qemuDomainSetMemoryStatsPeriod(virDomainPtr dom, int period, }
if (persistentDef) { - if (!persistentDef->memballoon || - persistentDef->memballoon->model != VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO) { + if (!qemuDomainDefHasMemballoon(persistentDef)) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Memory balloon model must be virtio to set the" " collection period")); @@ -11495,8 +11493,7 @@ qemuDomainMemoryStats(virDomainPtr dom, goto endjob; }
- if (vm->def->memballoon && - vm->def->memballoon->model == VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO) { + if (qemuDomainDefHasMemballoon(vm->def)) { priv = vm->privateData; qemuDomainObjEnterMonitor(driver, vm); ret = qemuMonitorGetMemoryStats(priv->mon, stats, nr_stats); @@ -19061,8 +19058,7 @@ qemuDomainGetStatsBalloon(virQEMUDriverPtr driver ATTRIBUTE_UNUSED, unsigned long long cur_balloon = 0; int err = 0;
- if (dom->def->memballoon && - dom->def->memballoon->model == VIR_DOMAIN_MEMBALLOON_MODEL_NONE) { + if (!qemuDomainDefHasMemballoon(dom->def)) {
Ugh.. the ugly duckling
This changes the statement from if we have a model=NONE memballoon to we have a memballoon with a model that's not NONE. Double negatives.
That is a bug actually but doesn't manifest itself in qemu, since no memballoon element is not possible. Do disable the memballoon it's necessary to specify the NONE model, otherwise the VIRTIO model gets auto-added.
I think the logic has the right thought, but would be perhaps clearer in my mind with the adjusted logic in the common function.
I think this is ACK-able just want get your thoughts on the logic for the helper...
John
Peter

--- src/qemu/qemu_driver.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index a00268b..8b9801a 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -11471,7 +11471,6 @@ qemuDomainMemoryStats(virDomainPtr dom, unsigned int flags) { virQEMUDriverPtr driver = dom->conn->privateData; - qemuDomainObjPrivatePtr priv; virDomainObjPtr vm; int ret = -1; long rss; @@ -11494,9 +11493,8 @@ qemuDomainMemoryStats(virDomainPtr dom, } if (qemuDomainDefHasMemballoon(vm->def)) { - priv = vm->privateData; qemuDomainObjEnterMonitor(driver, vm); - ret = qemuMonitorGetMemoryStats(priv->mon, stats, nr_stats); + ret = qemuMonitorGetMemoryStats(qemuDomainGetMonitor(vm), stats, nr_stats); if (qemuDomainObjExitMonitor(driver, vm) < 0) ret = -1; -- 2.8.0

No need to store failure and re-check right away. --- src/qemu/qemu_process.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 4911c1d..a8c5139 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -1942,10 +1942,7 @@ qemuProcessRefreshBalloonState(virQEMUDriverPtr driver, return -1; rc = qemuMonitorGetBalloonInfo(qemuDomainGetMonitor(vm), &balloon); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - rc = -1; - - if (rc < 0) + if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0) return -1; vm->def->mem.cur_balloon = balloon; -- 2.8.0

Rather than trying some magic calculations on our side query the monitor for the current size of the memory balloon both on hotplug and hotunplug. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1220702 --- src/qemu/qemu_hotplug.c | 15 ++++++--------- src/qemu/qemu_process.c | 2 +- src/qemu/qemu_process.h | 4 ++++ 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 48bea6a..f77d65a 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -33,6 +33,7 @@ #include "qemu_command.h" #include "qemu_hostdev.h" #include "qemu_interface.h" +#include "qemu_process.h" #include "domain_audit.h" #include "netdev_bandwidth_conf.h" #include "domain_nwfilter.h" @@ -1742,7 +1743,6 @@ qemuDomainAttachMemory(virQEMUDriverPtr driver, const char *backendType; virJSONValuePtr props = NULL; virObjectEventPtr event; - bool fix_balloon = false; int id; int ret = -1; @@ -1757,9 +1757,6 @@ qemuDomainAttachMemory(virQEMUDriverPtr driver, if (virAsprintf(&objalias, "mem%s", mem->info.alias) < 0) goto cleanup; - if (vm->def->mem.cur_balloon == virDomainDefGetMemoryActual(vm->def)) - fix_balloon = true; - if (!(devstr = qemuBuildMemoryDeviceStr(mem))) goto cleanup; @@ -1800,9 +1797,8 @@ qemuDomainAttachMemory(virQEMUDriverPtr driver, event = virDomainEventDeviceAddedNewFromObj(vm, objalias); qemuDomainEventQueue(driver, event); - /* fix the balloon size if it was set to maximum */ - if (fix_balloon) - vm->def->mem.cur_balloon += mem->size; + /* fix the balloon size */ + ignore_value(qemuProcessRefreshBalloonState(driver, vm, QEMU_ASYNC_JOB_NONE)); /* mem is consumed by vm->def */ mem = NULL; @@ -2939,13 +2935,14 @@ qemuDomainRemoveMemoryDevice(virQEMUDriverPtr driver, if (rc < 0) return -1; - vm->def->mem.cur_balloon -= mem->size; - if ((idx = virDomainMemoryFindByDef(vm->def, mem)) >= 0) virDomainMemoryRemove(vm->def, idx); virDomainMemoryDefFree(mem); + /* fix the balloon size */ + ignore_value(qemuProcessRefreshBalloonState(driver, vm, QEMU_ASYNC_JOB_NONE)); + /* decrease the mlock limit after memory unplug if necessary */ ignore_value(qemuDomainAdjustMaxMemLock(vm)); diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index a8c5139..c7456af 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -1923,7 +1923,7 @@ qemuRefreshVirtioChannelState(virQEMUDriverPtr driver, } -static int +int qemuProcessRefreshBalloonState(virQEMUDriverPtr driver, virDomainObjPtr vm, int asyncJob) diff --git a/src/qemu/qemu_process.h b/src/qemu/qemu_process.h index d5f50f2..98cc9a8 100644 --- a/src/qemu/qemu_process.h +++ b/src/qemu/qemu_process.h @@ -193,4 +193,8 @@ int qemuProcessSetupIOThread(virDomainObjPtr vm, int qemuRefreshVirtioChannelState(virQEMUDriverPtr driver, virDomainObjPtr vm); + +int qemuProcessRefreshBalloonState(virQEMUDriverPtr driver, + virDomainObjPtr vm, + int asyncJob); #endif /* __QEMU_PROCESS_H__ */ -- 2.8.0

On Wed, Apr 06, 2016 at 18:02:20 +0200, Peter Krempa wrote:
Clean up some of the memory balloon code and fix the calculation of size after hotplug.
Peter Krempa (8): qemu: command: Assume QEMU_CAPS_DEVICE when building memballoon args qemu: caps: Deprecate QEMU_CAPS_BALLOON qemu: command: Drop obsolete comment qemu: command: Refactor memballoon command line formatting qemu: domain: Add helper to determine presence of memory baloon qemu: driver: Reuse qemuDomainGetMonitor in qemuDomainMemoryStats qemu: process: Simplify condition in qemuProcessRefreshBalloonState qemu: hotplug: Properly recalculate/reload balloon size after hot(un)plug
Ping. Thanks for any takers. Peter

On 04/14/2016 12:08 PM, Peter Krempa wrote:
On Wed, Apr 06, 2016 at 18:02:20 +0200, Peter Krempa wrote:
Clean up some of the memory balloon code and fix the calculation of size after hotplug.
Peter Krempa (8): qemu: command: Assume QEMU_CAPS_DEVICE when building memballoon args qemu: caps: Deprecate QEMU_CAPS_BALLOON qemu: command: Drop obsolete comment qemu: command: Refactor memballoon command line formatting qemu: domain: Add helper to determine presence of memory baloon qemu: driver: Reuse qemuDomainGetMonitor in qemuDomainMemoryStats qemu: process: Simplify condition in qemuProcessRefreshBalloonState qemu: hotplug: Properly recalculate/reload balloon size after hot(un)plug
Ping. Thanks for any takers.
I'll get to it later today, if you'll trade reviews :) Most are trivial http://www.redhat.com/archives/libvir-list/2016-April/msg00505.html http://www.redhat.com/archives/libvir-list/2016-April/msg00535.html http://www.redhat.com/archives/libvir-list/2016-April/msg00536.html http://www.redhat.com/archives/libvir-list/2016-April/msg00537.html http://www.redhat.com/archives/libvir-list/2016-April/msg00634.html http://www.redhat.com/archives/libvir-list/2016-April/msg00694.html http://www.redhat.com/archives/libvir-list/2016-April/msg00720.html - Cole

On 04/06/2016 12:02 PM, Peter Krempa wrote:
Clean up some of the memory balloon code and fix the calculation of size after hotplug.
Peter Krempa (8): qemu: command: Assume QEMU_CAPS_DEVICE when building memballoon args qemu: caps: Deprecate QEMU_CAPS_BALLOON qemu: command: Drop obsolete comment qemu: command: Refactor memballoon command line formatting qemu: domain: Add helper to determine presence of memory baloon qemu: driver: Reuse qemuDomainGetMonitor in qemuDomainMemoryStats qemu: process: Simplify condition in qemuProcessRefreshBalloonState qemu: hotplug: Properly recalculate/reload balloon size after hot(un)plug
src/qemu/qemu_capabilities.c | 3 - src/qemu/qemu_capabilities.h | 2 +- src/qemu/qemu_command.c | 83 +++++++++------------------ src/qemu/qemu_command.h | 4 -- src/qemu/qemu_domain.c | 11 +++- src/qemu/qemu_domain.h | 1 + src/qemu/qemu_driver.c | 16 ++---- src/qemu/qemu_hotplug.c | 15 ++--- src/qemu/qemu_process.c | 16 ++---- src/qemu/qemu_process.h | 4 ++ tests/qemucapabilitiesdata/caps_1.2.2-1.caps | 1 - tests/qemucapabilitiesdata/caps_1.3.1-1.caps | 1 - tests/qemucapabilitiesdata/caps_1.4.2-1.caps | 1 - tests/qemucapabilitiesdata/caps_1.5.3-1.caps | 1 - tests/qemucapabilitiesdata/caps_1.6.0-1.caps | 1 - tests/qemucapabilitiesdata/caps_1.6.50-1.caps | 1 - tests/qemucapabilitiesdata/caps_2.1.1-1.caps | 1 - tests/qemucapabilitiesdata/caps_2.4.0-1.caps | 1 - tests/qemucapabilitiesdata/caps_2.5.0-1.caps | 1 - tests/qemucapabilitiesdata/caps_2.6.0-1.caps | 1 - tests/qemuhelptest.c | 8 --- 21 files changed, 59 insertions(+), 114 deletions(-)
ACK series modulo patch 5 which I think needs a couple adjustments. John
participants (3)
-
Cole Robinson
-
John Ferlan
-
Peter Krempa