[libvirt] [PATCH] qemu: align the cur_balloon too if not explicitly specified by the user
Peter Krempa
pkrempa at redhat.com
Fri Jan 8 15:33:58 UTC 2016
On Thu, Dec 10, 2015 at 20:26:31 +0530, Shivaprasad G Bhat wrote:
> As of now, the cur_ballon is set to actual memory if not specified by the user.
> When the user specified memory is not aligned the cur_balloon alone ends up
> unaligned. For qemu in function qemuDomainAttachMemory(), the cur_balloon
> wouldn't add up to the actual memory as the cur_ballon was not aligned.
> So, there is need for explicit setmem post attach-device for such guests.
>
> The decision as to whether to align the cur_balloon memory or not is
> not possible if we set it to actual memory by default in post-parse.
> Move the default cur_balloon assignment to their respective drivers during
> domain start wherever possible. For qemu align the cur_balloon too iow assign
> the aligned actual memory when not specified by the user.
>
> Signed-off-by: Shivaprasad G Bhat <sbhat at linux.vnet.ibm.com>
> ---
Sorry for the delay. I was on christmas hollidays and I'm catching up
with stuff that nappened earlier.
> src/conf/domain_conf.c | 3 +--
> src/libxl/libxl_conf.c | 2 ++
> src/lxc/lxc_process.c | 3 +++
> src/openvz/openvz_driver.c | 13 +++++++------
> src/phyp/phyp_driver.c | 10 +++-------
> src/qemu/qemu_domain.c | 3 +++
> src/uml/uml_conf.c | 3 +++
> src/vbox/vbox_common.c | 3 +++
> src/vmx/vmx.c | 3 +++
> src/vz/vz_sdk.c | 3 +++
> src/xenconfig/xen_common.c | 3 +++
> src/xenconfig/xen_sxpr.c | 4 ++++
> 12 files changed, 38 insertions(+), 15 deletions(-)
So at first:
This breaks lxcconf2xmltest:
TEST: lxcconf2xmltest
!.!!!!!!!!!! 12 FAIL
>
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index 2f5c0ed..68338f4 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -3527,8 +3527,7 @@ virDomainDefPostParseMemory(virDomainDefPtr def,
> return -1;
> }
>
> - if (def->mem.cur_balloon > virDomainDefGetMemoryActual(def) ||
> - def->mem.cur_balloon == 0)
> + if (def->mem.cur_balloon > virDomainDefGetMemoryActual(def))
> def->mem.cur_balloon = virDomainDefGetMemoryActual(def);
It probably would be better to add a bool that signalizes that this
field was not provided by the user (at the point where cur_balloon gets
parsed) and then just modify the qemu code when starting to override the
number.
>
> if ((def->mem.max_memory || def->mem.memory_slots) &&
> diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
> index 4eed5ca..6b6e764 100644
> --- a/src/libxl/libxl_conf.c
> +++ b/src/libxl/libxl_conf.c
> @@ -665,6 +665,8 @@ libxlMakeDomBuildInfo(virDomainDefPtr def,
> }
> b_info->sched_params.weight = 1000;
> b_info->max_memkb = virDomainDefGetMemoryInitial(def);
> + if (!def->mem.cur_balloon)
> + def->mem.cur_balloon = virDomainDefGetMemoryInitial(def);
You then won't have to change any other driver, while making it work for
qemu. Additionally it will not break the lxc test.
> b_info->target_memkb = def->mem.cur_balloon;
> if (hvm) {
> char bootorder[VIR_DOMAIN_BOOT_LAST + 1];
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20160108/b0f4e292/attachment-0001.sig>
More information about the libvir-list
mailing list