mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
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);
|
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 */
|
/* fix total memory size of the domain */
|
||||||
virDomainDefSetMemoryTotal(def, memory - ret->size);
|
virDomainDefSetMemoryTotal(def, memory - ret->size);
|
||||||
|
|
||||||
|
@ -7768,8 +7768,7 @@ qemuDomainAttachDeviceConfig(virDomainDefPtr vmdef,
|
|||||||
return -1;
|
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)
|
if (virDomainMemoryInsert(vmdef, dev->data.memory) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
@ -7826,6 +7825,7 @@ qemuDomainDetachDeviceConfig(virDomainDefPtr vmdef,
|
|||||||
virDomainControllerDefPtr cont, det_cont;
|
virDomainControllerDefPtr cont, det_cont;
|
||||||
virDomainChrDefPtr chr;
|
virDomainChrDefPtr chr;
|
||||||
virDomainFSDefPtr fs;
|
virDomainFSDefPtr fs;
|
||||||
|
virDomainMemoryDefPtr mem;
|
||||||
int idx;
|
int idx;
|
||||||
|
|
||||||
switch ((virDomainDeviceType) dev->type) {
|
switch ((virDomainDeviceType) dev->type) {
|
||||||
@ -7923,8 +7923,9 @@ qemuDomainDetachDeviceConfig(virDomainDefPtr vmdef,
|
|||||||
_("matching memory device was not found"));
|
_("matching memory device was not found"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
mem = virDomainMemoryRemove(vmdef, idx);
|
||||||
virDomainMemoryDefFree(virDomainMemoryRemove(vmdef, idx));
|
vmdef->mem.cur_balloon -= mem->size;
|
||||||
|
virDomainMemoryDefFree(mem);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VIR_DOMAIN_DEVICE_REDIRDEV:
|
case VIR_DOMAIN_DEVICE_REDIRDEV:
|
||||||
|
Loading…
Reference in New Issue
Block a user