[libvirt] [PATCH 11/16] LXC from native: map lxc.cgroup.cpu.*
Daniel P. Berrange
berrange at redhat.com
Fri Jan 24 13:53:20 UTC 2014
On Tue, Jan 14, 2014 at 02:50:00PM +0100, Cédric Bosdonnat wrote:
> ---
> src/lxc/lxc_native.c | 26 ++++++++++++++++
> tests/lxcconf2xmldata/lxcconf2xml-cputune.config | 9 ++++++
> tests/lxcconf2xmldata/lxcconf2xml-cputune.xml | 38 ++++++++++++++++++++++++
> tests/lxcconf2xmltest.c | 1 +
> 4 files changed, 74 insertions(+)
> create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-cputune.config
> create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-cputune.xml
>
> diff --git a/src/lxc/lxc_native.c b/src/lxc/lxc_native.c
> index 582924e..80b7e74 100644
> --- a/src/lxc/lxc_native.c
> +++ b/src/lxc/lxc_native.c
> @@ -790,6 +790,28 @@ lxcSetMemTune(virDomainDefPtr def, virPropertiesPtr properties)
> def->mem.swap_hard_limit = lxcConvertSize(value, 0) / 1024;
> }
>
> +static int
> +lxcSetCpuTune(virDomainDefPtr def, virPropertiesPtr properties)
> +{
> + char *value;
> +
> + if ((value = virPropertiesLookup(properties, "lxc.cgroup.cpu.shares")) &&
> + virStrToLong_ul(value, NULL, 10, &def->cputune.shares) < 0)
> + return -1;
> +
> + if ((value = virPropertiesLookup(properties,
> + "lxc.cgroup.cpu.cfs_quota_us")) &&
> + virStrToLong_ll(value, NULL, 10, &def->cputune.quota) < 0)
> + return -1;
> +
> + if ((value = virPropertiesLookup(properties,
> + "lxc.cgroup.cpu.cfs_period_us")) &&
> + virStrToLong_ull(value, NULL, 10, &def->cputune.period) < 0)
> + return -1;
> +
> + return 0;
> +}
Again error reporting when virStrToLong_ull fails
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