[libvirt] Globally Reserve Resources for Host
dustymabe at gmail.com
Wed Nov 14 16:22:59 UTC 2012
On Thu, Nov 1, 2012 at 11:32 PM, Dusty Mabe <dustymabe at gmail.com> wrote:
> On Thu, Nov 1, 2012 at 11:09 AM, Eric Blake <eblake at redhat.com> wrote:
>> 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.
> Thanks for the response and some pointers to relevant design
> information. If I get some free cycles to implement such a feature I
> will get back to you with some more targeted design questions or maybe
> even a possible implementation.
I think i have a very minimal implementation of what I proposed in my
original email ("reserving resources for host"). It is not quite as
featureful as what you discussed with danpb
but it is a small amount of work and should be worth the effort.
As of right now this is specifically for qemu - Basically the idea is
that right after the cgroup gets created for the qemu driver we will
set memory and cpu restrictions for the group like so:
rc = virCgroupForDriver("qemu", &qemu_driver->cgroup, privileged, 1);
rc = virCgroupSetMemory(&qemu_driver->cgroup, availableMem);
rc = virCgroupSetCpus(&qemu_driver->cgroup, availableCpus);
The user will provide values in qemu.conf for "reservedHostMem" and
"reservedHostCpus" and then availableMem and availableCpus would be
calculated from that. If no values were provided in the conf then
simply act as normal and don't enforce any "restrictions".
We may also want to expose this "setting" in virsh so that we could
change the value once up and running.
Does this seem trivial to implement as I suggest? Are there any flaws
with this idea?
More information about the libvir-list