On 11/01/2012 07:16 AM, Dusty Mabe wrote:
Hi,
I am interested in the capability to globally reserve resources(cpu and
memory) for a KVM host. I know you can configure memory limits for each
guest (
http://libvirt.org/formatdomain.html#elementsMemoryTuning), but
would like the ability to reserve host cpu and memory without having to
actively do it by modifying each guests xml.
For clarity, what I mean by "reserve resources" is that there are certain
cpus and a certain amount of memory that guests will never have access to.
This can be achieved using cgroups.
Does anyone think this functionality would be useful? This is primarily to
prevent the host from being starved when the allocation of guests have the
host overcommitted/oversubscribed.
Yes, this functionality would be useful. In fact, I even proposed a
possible design, and Dan chimed in with some improvements (but no one
has coded anything towards that design) ages ago:
https://www.redhat.com/archives/libvir-list/2011-March/msg01546.html
Basically, you would create a virGroupPtr that describes the entire
resources you are willing to allow to VMs, then ensure that all VMs are
members of that virGroupPtr.
The idea of a virGroupPtr also makes it possible to isolate
host-specific management out of per-guest XML, making it easier to
migrate guests. For example, instead of hard-coding that a guest is
pinned to host cpus 4-7, you would state that a guest's cpu usage is
determined by a named virGroup policy, and as long as that named policy
provides 4 cpus on both source and destination, the actual decision of
WHICH 4 host cpus are in the group can differ between the hosts, so that
you don't have to have the same cpus available on the migration
destination, and don't have to write a migration hook to rewrite the XML
to redo the pinning.
--
Eric Blake eblake(a)redhat.com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org