mirror of https://gitee.com/openkylin/libvirt.git
qemu: Adjust the cur_ballon on coldplug/unplug of dimms
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@linux.vnet.ibm.com> Signed-off-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
parent
c5d0a2a385
commit
707063efa8
|
@ -14623,10 +14623,6 @@ 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);
|
||||
|
||||
/* fix total memory size of the domain */
|
||||
virDomainDefSetMemoryTotal(def, memory - ret->size);
|
||||
|
||||
|
|
|
@ -7768,7 +7768,6 @@ qemuDomainAttachDeviceConfig(virDomainDefPtr vmdef,
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (vmdef->mem.cur_balloon == virDomainDefGetMemoryTotal(vmdef))
|
||||
vmdef->mem.cur_balloon += dev->data.memory->size;
|
||||
|
||||
if (virDomainMemoryInsert(vmdef, dev->data.memory) < 0)
|
||||
|
@ -7826,6 +7825,7 @@ qemuDomainDetachDeviceConfig(virDomainDefPtr vmdef,
|
|||
virDomainControllerDefPtr cont, det_cont;
|
||||
virDomainChrDefPtr chr;
|
||||
virDomainFSDefPtr fs;
|
||||
virDomainMemoryDefPtr mem;
|
||||
int idx;
|
||||
|
||||
switch ((virDomainDeviceType) dev->type) {
|
||||
|
@ -7923,8 +7923,9 @@ qemuDomainDetachDeviceConfig(virDomainDefPtr vmdef,
|
|||
_("matching memory device was not found"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
virDomainMemoryDefFree(virDomainMemoryRemove(vmdef, idx));
|
||||
mem = virDomainMemoryRemove(vmdef, idx);
|
||||
vmdef->mem.cur_balloon -= mem->size;
|
||||
virDomainMemoryDefFree(mem);
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_DEVICE_REDIRDEV:
|
||||
|
|
Loading…
Reference in New Issue