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