[libvirt] [PATCH 5/9] blkio: Setting throttle blkio cgroup for domain

Daniel P. Berrange berrange at redhat.com
Tue Dec 10 15:33:56 UTC 2013


On Mon, Dec 02, 2013 at 02:48:00PM +0800, Gao feng wrote:
> This patch extends virCgroupSetBlkioWeightDevice and
> rename it the virCgroupSetBlkioDevice, now we can use
> this interface to set up throttle blkio cgroup too.
> 
> Signed-off-by: Guan Qiang <hzguanqiang at corp.netease.com>
> Signed-off-by: Gao feng <gaofeng at cn.fujitsu.com>
> ---
>  src/libvirt_private.syms |   3 +
>  src/lxc/lxc_cgroup.c     |  10 ++-
>  src/qemu/qemu_cgroup.c   |  11 +--
>  src/qemu/qemu_driver.c   |  10 ++-
>  src/util/vircgroup.c     | 170 ++++++++++++++++++++++++++++++++++++++++++++---
>  src/util/vircgroup.h     |  18 +++++
>  6 files changed, 203 insertions(+), 19 deletions(-)
> diff --git a/src/util/vircgroup.h b/src/util/vircgroup.h
> index 835eb30..99c3a35 100644
> --- a/src/util/vircgroup.h
> +++ b/src/util/vircgroup.h
> @@ -126,6 +126,24 @@ int virCgroupSetBlkioDeviceWeight(virCgroupPtr group,
>                                    const char *path,
>                                    unsigned int weight);
>  
> +int virCgroupSetBlkioDeviceIops(virCgroupPtr group,
> +                                const char *path,
> +                                bool read,
> +                                unsigned int iops);
> +
> +int virCgroupSetBlkioDeviceBps(virCgroupPtr group,
> +                                const char *path,
> +                                bool read,
> +                                unsigned long long bps);

I think it is preferrable to have separate methods for read and
write, because no one reading the code will ever remember that
'true == read' and 'false == write' in parameters.

> +int virCgroupSetBlkioDevice(virCgroupPtr group,
> +                            const char *path,
> +                            unsigned int weight,
> +                            unsigned int riops,
> +                            unsigned int wiops,
> +                            unsigned long long rbps,
> +                            unsigned long long wbps);

I don't think this method serves any real useful purpose - just call
the other public APIs directly.

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 :|




More information about the libvir-list mailing list