[libvirt] [PATCH] Don't call virCgroupSetCpuShares with a zero value
Eric Blake
eblake at redhat.com
Fri Dec 13 16:20:52 UTC 2013
On 12/13/2013 09:18 AM, Ján Tomko wrote:
> In the XML parser, a zero in the <shares> element is treated
> as if it was omitted completely. No value is written to
> the cgroups fs when the domain is started and the OS default
> is used.
>
> virDomainSetSchedulerParameters treated 0 as a valid value,
> which got changed to '2' by kernel. Treat 0 as 'not specified'
> instead, to be consistent with the XML and how other scheduler
> parameters deal with a 0 value, making it a no-op on live domains.
>
> Also clarify the documentation.
> ---
> +++ b/src/lxc/lxc_driver.c
> @@ -1732,7 +1732,7 @@ lxcDomainSetSchedulerParametersFlags(virDomainPtr dom,
> virTypedParameterPtr param = ¶ms[i];
>
> if (STREQ(param->field, VIR_DOMAIN_SCHEDULER_CPU_SHARES)) {
> - if (flags & VIR_DOMAIN_AFFECT_LIVE) {
> + if (flags & VIR_DOMAIN_AFFECT_LIVE && params[i].value.ul) {
> if (virCgroupSetCpuShares(priv->cgroup, params[i].value.ul) < 0)
If the value was previously set to non-zero, don't you need to do
something to explicitly unset that old value, rather than just ignoring
the option altogether?
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 621 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20131213/c249bbc7/attachment-0001.sig>
More information about the libvir-list
mailing list