Re: [PATCH 13/16] LXC from native: add lxc.cgroup.blkio.* mapping

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

 



On Tue, Jan 14, 2014 at 02:50:02PM +0100, Cédric Bosdonnat wrote:
> ---
>  src/lxc/lxc_native.c                               | 44 ++++++++++++++++++++++
>  tests/lxcconf2xmldata/lxcconf2xml-blkiotune.config |  9 +++++
>  tests/lxcconf2xmldata/lxcconf2xml-blkiotune.xml    | 44 ++++++++++++++++++++++
>  tests/lxcconf2xmltest.c                            |  1 +
>  4 files changed, 98 insertions(+)
>  create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-blkiotune.config
>  create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-blkiotune.xml
> 
> diff --git a/src/lxc/lxc_native.c b/src/lxc/lxc_native.c
> index 635eb89..75e05a5 100644
> --- a/src/lxc/lxc_native.c
> +++ b/src/lxc/lxc_native.c
> @@ -835,6 +835,46 @@ lxcSetCpusetTune(virDomainDefPtr def, virPropertiesPtr properties)
>      return 0;
>  }
>  
> +static int
> +lxcSetBlkioTune(virDomainDefPtr def, virPropertiesPtr properties)
> +{
> +    char *value;
> +    char **parts;
> +    virBlkioDevicePtr device = NULL;
> +
> +    if ((value = virPropertiesLookup(properties, "lxc.cgroup.blkio.weight")) &&
> +            virStrToLong_ui(value, NULL, 10, &def->blkio.weight) < 0)
> +        return -1;
> +
> +    value = virPropertiesLookup(properties, "lxc.cgroup.blkio.device_weight");
> +    while (value) {
> +        if (!(parts = lxcStringSplit(value)))
> +            return -1;
> +
> +        if (!parts[0] || !parts[1])
> +            goto error;
> +
> +        if (VIR_EXPAND_N(def->blkio.devices, def->blkio.ndevices, 1) < 0)
> +            goto error;
> +        device = &def->blkio.devices[def->blkio.ndevices - 1];
> +
> +        if (virAsprintf(&device->path, "/dev/block/%s", parts[0]) < 0)
> +            goto error;
> +
> +        if (virStrToLong_ui(parts[1], NULL, 10, &device->weight) < 0)
> +            goto error;

virReportError here

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]