From: Peter Krempa Date: Wed, 27 May 2015 13:04:14 +0000 (+0200) Subject: qemu: process: Update current balloon state to maximum on vm startup X-Git-Tag: v1.2.17-rc1~283 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=641a145d73fdc3dd9350fd57b3d3247abf101c05;p=thirdparty%2Flibvirt.git qemu: process: Update current balloon state to maximum on vm startup After libvirt issues the balloon resize command, the current balloon size needs to be changed to the maximum memory size since the vCPUs were not started and thus the balloon driver could not return the memory. Since GetXMLDesc and other APIs return the balloon size without updating it in case they are not able to obtain the job and the memory balloon does not support the asynchronous event the sizing might be incorrect. --- diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index d5d9369762..7f154f0349 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -4897,6 +4897,11 @@ int qemuProcessStart(virConnectPtr conn, goto cleanup; } + /* Since CPUs were not started yet, the ballon could not return the memory + * to the host and thus cur_balloon needs to be updated so that GetXMLdesc + * and friends return the correct size in case they can't grab the job */ + vm->def->mem.cur_balloon = virDomainDefGetMemoryActual(vm->def); + VIR_DEBUG("Detecting actual memory size for video device"); if (qemuProcessUpdateVideoRamSize(driver, vm, asyncJob) < 0) goto cleanup;