From aa699de198c52868d08679176dd8355deb24ef82 Mon Sep 17 00:00:00 2001
Message-Id: <aa699de198c52868d08679176dd8355deb24ef82@dist-git>
From: Pavel Hrdina <phrdina@redhat.com>
Date: Mon, 1 Jul 2019 17:08:19 +0200
Subject: [PATCH] util: vircgroupv2: enable CPU controller only if it's
available
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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 <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit f9d1c08557ddb981a0d889200431185a9c4920e0)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1689297
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Message-Id: <2a13e05dfbbe52f05541c881964ce92709e5d36a.1561993100.git.phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
src/util/vircgroupv2.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/util/vircgroupv2.c b/src/util/vircgroupv2.c
index 04cbadd6a6..98d313bf82 100644
--- a/src/util/vircgroupv2.c
+++ b/src/util/vircgroupv2.c
@@ -403,7 +403,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;
}
--
2.22.0