[libvirt] [PATCH] qemu: Adjust the cur_ballon on coldplug/unplug of dimms

Shivaprasad G Bhat sbhat at linux.vnet.ibm.com
Thu Jul 21 10:09:30 UTC 2016


The cur_balloon also increases/decreases with dimm hotplug/unplug.
To be consistent, adjust the value for coldplug too. This was inconsistently
taken care when cur_ballon != memory to begin with. The patch fixes it
irrespective of that.

Signed-off-by: Shivaprasad G Bhat <sbhat at linux.vnet.ibm.com>
---
 src/conf/domain_conf.c |    3 +--
 src/qemu/qemu_driver.c |    3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 6dfcf81..8b0b790 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -14674,8 +14674,7 @@ virDomainMemoryRemove(virDomainDefPtr def,
     VIR_DELETE_ELEMENT(def->mems, idx, def->nmems);
 
     /* fix up balloon size */
-    if (def->mem.cur_balloon > virDomainDefGetMemoryTotal(def))
-        def->mem.cur_balloon = virDomainDefGetMemoryTotal(def);
+    def->mem.cur_balloon -= ret->size;
 
     /* fix total memory size of the domain */
     virDomainDefSetMemoryTotal(def, memory - ret->size);
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index cda85f6..3824e1d 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -7769,8 +7769,7 @@ qemuDomainAttachDeviceConfig(virDomainDefPtr vmdef,
             return -1;
         }
 
-        if (vmdef->mem.cur_balloon == virDomainDefGetMemoryTotal(vmdef))
-            vmdef->mem.cur_balloon += dev->data.memory->size;
+        vmdef->mem.cur_balloon += dev->data.memory->size;
 
         if (virDomainMemoryInsert(vmdef, dev->data.memory) < 0)
             return -1;




More information about the libvir-list mailing list