]> xenbits.xensource.com Git - libvirt.git/commit
conf: Remove pre-calculation of initial memory size
authorPeter Krempa <pkrempa@redhat.com>
Tue, 14 Jun 2016 09:23:23 +0000 (11:23 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 17 Jun 2016 08:36:41 +0000 (10:36 +0200)
commita877a1635b8a2cb88170767ca3c28c0d755b21a8
treec1d75f043c74f45223f994f3816308815e0ec27f
parent23690e1d74b3551eecb69e2187ed4089238a9838
conf: Remove pre-calculation of initial memory size

While we need to know the difference between the total memory stored in
<memory> and the actual size not included in the possible memory modules
we can't pre-calculate it reliably. This is due to the fact that
libvirt's XML is copied via formatting and parsing the XML and the
initial memory size can be reliably calculated only when certain
conditions are met due to backwards compatibility.

This patch removes the storage of 'initial_memory' and fixes the helpers
to recalculate the initial memory size all the time from the total
memory size. This conversion is possible when we also make sure that
memory hotplug accounts properly for the update of the total memory size
and thus the helpers for inserting and removing memory devices need to
be tweaked too.

This fixes a bug where a cold-plug and cold-remove of a memory device
would increase the size reported in <memory> in the XML by the size of
the memory device. This would happen as the persistent definition is
copied before attaching the device and this would lead to the loss of
data in 'initial_memory'.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1344892
src/conf/domain_conf.c
src/conf/domain_conf.h
src/libvirt_private.syms
src/qemu/qemu_domain.c