1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-07 17:28:15 +00:00

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.
This commit is contained in:
Peter Krempa 2015-04-30 17:43:53 +02:00
parent fccc2c3313
commit de03b1ddde

View File

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