|
|
c313de |
From 6d526969ab72e7c35b988a7154d8343001a05208 Mon Sep 17 00:00:00 2001
|
|
|
c313de |
Message-Id: <6d526969ab72e7c35b988a7154d8343001a05208@dist-git>
|
|
|
c313de |
From: Pavel Hrdina <phrdina@redhat.com>
|
|
|
c313de |
Date: Thu, 25 Jul 2019 13:37:02 +0200
|
|
|
c313de |
Subject: [PATCH] vircgroupv2: store enabled controllers
|
|
|
c313de |
MIME-Version: 1.0
|
|
|
c313de |
Content-Type: text/plain; charset=UTF-8
|
|
|
c313de |
Content-Transfer-Encoding: 8bit
|
|
|
c313de |
|
|
|
c313de |
In cgroups v2 when a new group is created by default no controller is
|
|
|
c313de |
enabled so the detection code will not detect any controllers.
|
|
|
c313de |
|
|
|
c313de |
When enabling the controllers we should also store them for the group.
|
|
|
c313de |
|
|
|
c313de |
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
|
|
|
c313de |
Acked-by: Peter Krempa <pkrempa@redhat.com>
|
|
|
c313de |
(cherry picked from commit 56fdf3f025207a550726767e3f0ec1f290603ba4)
|
|
|
c313de |
|
|
|
c313de |
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1689297
|
|
|
c313de |
|
|
|
c313de |
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
|
|
|
c313de |
Message-Id: <3cef886d4257a746e5a7182246d5457664d8bcec.1564054553.git.phrdina@redhat.com>
|
|
|
c313de |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
c313de |
---
|
|
|
c313de |
src/util/vircgroupv2.c | 11 +++++++----
|
|
|
c313de |
1 file changed, 7 insertions(+), 4 deletions(-)
|
|
|
c313de |
|
|
|
c313de |
diff --git a/src/util/vircgroupv2.c b/src/util/vircgroupv2.c
|
|
|
c313de |
index 7b3cd64cc5..9ae47e775e 100644
|
|
|
c313de |
--- a/src/util/vircgroupv2.c
|
|
|
c313de |
+++ b/src/util/vircgroupv2.c
|
|
|
c313de |
@@ -364,7 +364,8 @@ virCgroupV2PathOfController(virCgroupPtr group,
|
|
|
c313de |
* 0 on success
|
|
|
c313de |
*/
|
|
|
c313de |
static int
|
|
|
c313de |
-virCgroupV2EnableController(virCgroupPtr parent,
|
|
|
c313de |
+virCgroupV2EnableController(virCgroupPtr group,
|
|
|
c313de |
+ virCgroupPtr parent,
|
|
|
c313de |
int controller,
|
|
|
c313de |
bool report)
|
|
|
c313de |
{
|
|
|
c313de |
@@ -390,6 +391,8 @@ virCgroupV2EnableController(virCgroupPtr parent,
|
|
|
c313de |
return -2;
|
|
|
c313de |
}
|
|
|
c313de |
|
|
|
c313de |
+ group->unified.controllers |= 1 << controller;
|
|
|
c313de |
+
|
|
|
c313de |
return 0;
|
|
|
c313de |
}
|
|
|
c313de |
|
|
|
c313de |
@@ -431,14 +434,14 @@ virCgroupV2MakeGroup(virCgroupPtr parent ATTRIBUTE_UNUSED,
|
|
|
c313de |
}
|
|
|
c313de |
|
|
|
c313de |
if (virCgroupV2HasController(parent, VIR_CGROUP_CONTROLLER_CPU) &&
|
|
|
c313de |
- virCgroupV2EnableController(parent,
|
|
|
c313de |
+ virCgroupV2EnableController(group, parent,
|
|
|
c313de |
VIR_CGROUP_CONTROLLER_CPU,
|
|
|
c313de |
true) < 0) {
|
|
|
c313de |
return -1;
|
|
|
c313de |
}
|
|
|
c313de |
|
|
|
c313de |
if (virCgroupV2HasController(parent, VIR_CGROUP_CONTROLLER_CPUSET) &&
|
|
|
c313de |
- virCgroupV2EnableController(parent,
|
|
|
c313de |
+ virCgroupV2EnableController(group, parent,
|
|
|
c313de |
VIR_CGROUP_CONTROLLER_CPUSET,
|
|
|
c313de |
true) < 0) {
|
|
|
c313de |
return -1;
|
|
|
c313de |
@@ -455,7 +458,7 @@ virCgroupV2MakeGroup(virCgroupPtr parent ATTRIBUTE_UNUSED,
|
|
|
c313de |
if (i == VIR_CGROUP_CONTROLLER_CPUACCT)
|
|
|
c313de |
continue;
|
|
|
c313de |
|
|
|
c313de |
- rc = virCgroupV2EnableController(parent, i, false);
|
|
|
c313de |
+ rc = virCgroupV2EnableController(group, parent, i, false);
|
|
|
c313de |
if (rc < 0) {
|
|
|
c313de |
if (rc == -2) {
|
|
|
c313de |
virResetLastError();
|
|
|
c313de |
--
|
|
|
c313de |
2.22.0
|
|
|
c313de |
|