From: Peter Krempa Date: Thu, 30 Apr 2015 15:43:53 +0000 (+0200) Subject: conf: Fix up balloon size after removing a memory device from def X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=de03b1dddee50f3f9718f03102697e7066af7f64;p=people%2Fliuw%2Flibxenctrl-split%2Flibvirt.git 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. --- diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 334283d70..e3e0f637d 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -12988,6 +12988,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; }