[libvirt] [PATCH 13/16] LXC from native: add lxc.cgroup.blkio.* mapping
Daniel P. Berrange
berrange at redhat.com
Fri Jan 24 13:55:21 UTC 2014
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 :|
More information about the libvir-list
mailing list