From: Pavel Hrdina Date: Thu, 20 Jun 2019 11:09:08 +0000 (+0200) Subject: util: vircgroupv2: enable CPU controller only if it's available X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=f9d1c08557ddb981a0d889200431185a9c4920e0;p=libvirt.git util: vircgroupv2: enable CPU controller only if it's available It might happen that we are not able to enable CPU controller so we can enable it for thread sub-cgroups only if it's available in parent cgroup. Signed-off-by: Pavel Hrdina Reviewed-by: Ján Tomko --- diff --git a/src/util/vircgroupv2.c b/src/util/vircgroupv2.c index 6bcbb7e1a0..3f4548b532 100644 --- a/src/util/vircgroupv2.c +++ b/src/util/vircgroupv2.c @@ -404,7 +404,8 @@ virCgroupV2MakeGroup(virCgroupPtr parent ATTRIBUTE_UNUSED, return -1; } - if (virCgroupV2EnableController(parent, + if (virCgroupV2HasController(parent, VIR_CGROUP_CONTROLLER_CPU) && + virCgroupV2EnableController(parent, VIR_CGROUP_CONTROLLER_CPU) < 0) { return -1; }