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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxx>
---
 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;

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]