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

[libvirt] [PATCH 2/3] conf: Fix up balloon size after removing a memory device from def



To avoid having the ballooned memory size larger than the actual
physical memory size, truncate the ballooned size if it overflows.
---
 src/conf/domain_conf.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index d397bca..3a1782e 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -12986,6 +12986,11 @@ virDomainMemoryRemove(virDomainDefPtr def,
 {
     virDomainMemoryDefPtr ret = def->mems[idx];
     VIR_DELETE_ELEMENT(def->mems, idx, def->nmems);
+
+    /* fix up balloon size */
+    if (def->mem.cur_balloon > virDomainDefGetMemoryActual(def))
+        def->mem.cur_balloon = virDomainDefGetMemoryActual(def);
+
     return ret;
 }

-- 
2.3.5


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