RFC: APIs for managing resource groups

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Historically for the QEMU/LXC drivers we've simply put each virtual
instance in a dedicated cgroup, under the path

  $LIBVIRT_CGROUP_LOCATION
    |
    +- libvirt
         |
         +- qemu
         |   |
         |   +- vm1
         |   +- vm2
         |   +- vm3
         |
         +- lxc
             |
             +- cont1
             +- cont2
             +- cont3

for a variety of reasons this nesting sucks. It is too deep causing
kernel performance problems, its structure does not easily allow for
calculating fixed % shares, it does not allow for grouping of VMs.

We need to simplify our layout and also introduce some APIs for the
grouping of VMs. I won't go into specifics of a new cgroups layout
here, just focus on the question of defining a set of APIs that are
generic to any hypervisor, for the purpose of setting up VM resource
groups.

I'm calling the resource cgroup a "partition", since this is all about
partitioning workloads.

I anticipate a new top level object and APIs for creating/defining it
in the usual manner:


typedef struct _virPartition virPartition;
typedef virPartition *virPartitionPtr;

int virConnectListAllPartitions(virConnectPtr conn,
                                virPartitionPtr **partitions,
                                unsigned int flags);

virPartitionPtr virPartitionDefineXML(virConnectPtr conn,
                                      const char *xml,
                                      unsigned int flags);

int virPartitionCreate(virPartitionPtr partition,
                       unsigned int flags);

int virPartitionCreateXML(virPartitionPtr partition,
                          const char *xml,
                          unsigned int flags);

int virPartitionDestroy(virPartitionPtr partition,
                        unsigned int flags);

int virPartitionUndefine(virPartitionPtr partition,
                         unsigned int flags);



Then I think we'll duplicate all the APIs for setting resource tunables
from virDomainPtr against the new object, so we get


int virPartitionGetSchedulerParameters(virPartitionPtr partition,
                                       virTypedParameterPtr params,
                                       int *nparams,
                                       unsigned int flags);

int virPartitionSetSchedulerParameters(virPartitionPtr partition,
                                       virTypedParameterPtr params,
                                       int nparams,
                                       unsigned int flags)

int virDomainSetBlkioParameters(virDomainPtr domain,
                                virTypedParameterPtr params,
                                int nparams,
                                unsigned int flags);

int virDomainGetBlkioParameters(virDomainPtr domain,
                                virTypedParameterPtr params,
                                int *nparams,
                                unsigned int flags);

int virDomainSetMemoryParameters(virDomainPtr domain,
                                 virTypedParameterPtr params,
                                 int nparams,
                                 unsigned int flags);
int virDomainGetMemoryParameters(virDomainPtr domain,
                                 virTypedParameterPtr params,
                                 int *nparams,
                                 unsigned int flags);
int virDomainSetNumaParameters(virDomainPtr domain,
                               virTypedParameterPtr params,
                               int nparams,
                               unsigned int flags);
int virDomainGetNumaParameters(virDomainPtr domain,
                               virTypedParameterPtr params,
                               int *nparams,
                               unsigned int flags);



Finally we need a way to associate a domain with a partition


virPartitionPtr virDomainGetPartition(virDomainPtr dom,
                                      unsigned int flags);

void virDomainSetPartition(virDomainPtr dom,
                           unsigned int flags);


There'd also likely be a new VM XML element

   <partition name="..partition name..."/>

which is what the Get/SetPartition methods would be touching.

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]