提交 707063ef 编写于 作者: S Shivaprasad G Bhat 提交者: Peter Krempa

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: NShivaprasad G Bhat <sbhat@linux.vnet.ibm.com>
Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
上级 c5d0a2a3
...@@ -14623,10 +14623,6 @@ virDomainMemoryRemove(virDomainDefPtr def, ...@@ -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,7 +7768,6 @@ qemuDomainAttachDeviceConfig(virDomainDefPtr vmdef, ...@@ -7768,7 +7768,6 @@ 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)
...@@ -7826,6 +7825,7 @@ qemuDomainDetachDeviceConfig(virDomainDefPtr vmdef, ...@@ -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, ...@@ -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:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册