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