]> git.proxmox.com Git - mirror_qemu.git/commit
virtio-balloon: Fix balloon not working correctly when hotplug memory
authorzhanghailiang <zhang.zhanghailiang@huawei.com>
Mon, 17 Nov 2014 05:11:09 +0000 (13:11 +0800)
committerLuiz Capitulino <lcapitulino@redhat.com>
Wed, 4 Mar 2015 18:00:04 +0000 (13:00 -0500)
commit463756d03164d640e3de00460488ba97302bf77e
treef01f7c0f6d2832482496748bb9dc5fa49ea6b7c4
parent87a45cfee6b169a68e43f284a8a3c1bc20bd5dc9
virtio-balloon: Fix balloon not working correctly when hotplug memory

When do memory balloon, it takes the 'ram_size' as the VM's current ram size,
But 'ram_size' is the startup configured ram size, it does not take into
account the hotplugged memory.

As a result, the balloon result will be confused.
Steps to reproduce:
(1)Start VM: qemu -m size=1024,slots=4,maxmem=8G
(2)In VM: #free -m : 1024M
(3)qmp balloon 512M
(4)In VM: #free -m : 512M
(5)hotplug pc-dimm 1G
(6)In VM: #free -m : 1512M
(7)qmp balloon 256M
(8)In VM: #free -m :1256M
We expect the VM's available ram size to be 256M after 'qmp balloon 256M'
command, but VM's real available ram size is 1256M.

For "qmp balloon" is not performance critical code, we use function
'get_current_ram_size' to get VM's current ram size.

Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
hw/virtio/virtio-balloon.c