[PATCH v3 10/14] qemu: Account for both memballoon and virtio-mem

Peter Krempa pkrempa at redhat.com
Mon May 3 14:02:01 UTC 2021

On Fri, Apr 23, 2021 at 15:24:32 +0200, Michal Privoznik wrote:
> Reporting how much memory is exposed to the guest happens under
> <currentMemory/> which is taken from def->mem.cur_balloon. The
> reported amount should account for both balloon size and the sum
> of @actualsize of all virtio-mems. For instance, if domain has
> 4GiB via balloon and additional 2GiB via virtio-mem, then the
> domain XML should report 6GiB. The same applies for domain
> statistics.
> The way to achieve this is to account for either balloon or
> virtio-mem when the size of the other is changed, e.g. on balloon
> change we have to add all @actualsize (for non virtio-mem these
> will be zero, so the check for memory model is needless, but
> makes it more obvious what's happening), and vice versa.

I think this needs to be recorded in a comment where the update happens.
Also the detail that the virtio-mem size isn't actually included in the
balloon size reported by qemu, because that's a rather important quirk
of all of this.

> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
> ---
>  src/qemu/qemu_driver.c  |  4 ++++
>  src/qemu/qemu_process.c | 17 +++++++++++++++++
>  2 files changed, 21 insertions(+)

The code looks okay, but I'll do a final review with the comments in

More information about the libvir-list mailing list