Hi all
As one of the maintainers of the Xen API tool-stack [1], I have
a couple of comments about these patches.
Currently, the Xen API tool-stack does not use libxenlight, but
we're interested in moving to it in the near future.
Yu Zhiguo wrote:
I'm trying to add subcommand 'mem-max', I think
xc_domain_setmaxmem should be used in it but not here.
I'll move this code to 'mem-max', and in 'mem-set', a check
should be added because setting memory larger than max memory
is invalid.
1. Add 'mem-max' Add libxl_domain_setmaxmem, it calls
xc_domain_setmaxmem. /local/domain/$domid/memory/static-max
should be updated when set max memory, it is missing now.
From the point of view of the Xen API tool-stack, these values
have different purposes.
1. The XenStore value: /local/domain/$domid/memory/static-max
This value reflects the maximum amount of physical host memory
that's addressable by the guest OS.
The Xen API tool-stack writes this value into XenStore at the
time of domain construction, and leaves the value alone until
the domain is destroyed.
I think it would make sense for libxenlight to do the same.
Many balloon drivers read this value, along with the "target"
field, in order to determine how large they should make their
balloons:
balloon size = (static-max - target)
In the absence of hotplug support, balloon drivers expect the
value of "static-max" to remain constant for the lifetime of
the domain.
2. The Xen value: maxmem
Xen uses this value as a sort of "ratchet", to prevent a domain
that's currently ballooned down from growing too large.
Xen will reject any call to domain_memory_increase_reservation
that would increase the reservation beyond the value of maxmex.
It's possible to change the value of "maxmex" while a domain is
running. Indeed, whenever the Xen API tool-stack writes a new
balloon target into XenStore, it also calls xc_domain_setmaxmem
with the same value.
This mechanism allows the tool-stack to prevent a balloon driver
from claiming back more memory if the guest is already using more
than its target memory allocation.
So, I think it's fair to say that locking these two values
together does not make sense from the point of view of the Xen API
tool-stack.
2. fix 'mem-set' Delete xc_domain_setmaxmem. Get max
memory from /local/domain/$domid/memory/static-max,
and then do value check. It seems that we cannot get
max memory use libxc routines.
If the purpose of "mem-set" is to set a balloon target for a
guest, then it might also make sense to call xc_domain_setmaxmem
with the same value, whenever the target changes, for the reasons
stated above (preventing a domain that's currently ballooned down
from growing too large).
I fixed it, please check.
[PATCH 1/2] xl: Add command 'xl mem-max' [PATCH 2/2]
xl: Add check for command 'xl mem-set'
Cheers,
Jonathan
[1] http://www.xen.org/products/cloud_source.html
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|