|
|
c480ed |
From 02b2342b6b5e45e3f41cb145521f53118ba8430f Mon Sep 17 00:00:00 2001
|
|
|
c480ed |
Message-Id: <02b2342b6b5e45e3f41cb145521f53118ba8430f@dist-git>
|
|
|
c480ed |
From: Pavel Hrdina <phrdina@redhat.com>
|
|
|
c480ed |
Date: Mon, 1 Jul 2019 17:08:21 +0200
|
|
|
c480ed |
Subject: [PATCH] util: vircgroupv2: don't error out if enabling controller
|
|
|
c480ed |
fails
|
|
|
c480ed |
MIME-Version: 1.0
|
|
|
c480ed |
Content-Type: text/plain; charset=UTF-8
|
|
|
c480ed |
Content-Transfer-Encoding: 8bit
|
|
|
c480ed |
|
|
|
c480ed |
Currently CPU controller cannot be enabled if there is any real-time
|
|
|
c480ed |
task running and is assigned to non-root cgroup which is the case on
|
|
|
c480ed |
several distributions with graphical environment.
|
|
|
c480ed |
|
|
|
c480ed |
Instead of erroring out treat it as the controller is not available.
|
|
|
c480ed |
|
|
|
c480ed |
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
|
|
|
c480ed |
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
|
|
|
c480ed |
(cherry picked from commit 1d49cdcd116186e079db5668893da17f56141652)
|
|
|
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: <4a10dec59ca8cf5a2f81acf70d43f48b0a3bfd82.1561993100.git.phrdina@redhat.com>
|
|
|
c480ed |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
c480ed |
---
|
|
|
c480ed |
src/util/vircgroupv2.c | 13 ++++++++++++-
|
|
|
c480ed |
1 file changed, 12 insertions(+), 1 deletion(-)
|
|
|
c480ed |
|
|
|
c480ed |
diff --git a/src/util/vircgroupv2.c b/src/util/vircgroupv2.c
|
|
|
c480ed |
index a67d5cfe04..e1ab1849ba 100644
|
|
|
c480ed |
--- a/src/util/vircgroupv2.c
|
|
|
c480ed |
+++ b/src/util/vircgroupv2.c
|
|
|
c480ed |
@@ -437,6 +437,8 @@ virCgroupV2MakeGroup(virCgroupPtr parent ATTRIBUTE_UNUSED,
|
|
|
c480ed |
} else {
|
|
|
c480ed |
size_t i;
|
|
|
c480ed |
for (i = 0; i < VIR_CGROUP_CONTROLLER_LAST; i++) {
|
|
|
c480ed |
+ int rc;
|
|
|
c480ed |
+
|
|
|
c480ed |
if (!virCgroupV2HasController(parent, i))
|
|
|
c480ed |
continue;
|
|
|
c480ed |
|
|
|
c480ed |
@@ -444,8 +446,17 @@ virCgroupV2MakeGroup(virCgroupPtr parent ATTRIBUTE_UNUSED,
|
|
|
c480ed |
if (i == VIR_CGROUP_CONTROLLER_CPUACCT)
|
|
|
c480ed |
continue;
|
|
|
c480ed |
|
|
|
c480ed |
- if (virCgroupV2EnableController(parent, i, true) < 0)
|
|
|
c480ed |
+ rc = virCgroupV2EnableController(parent, i, false);
|
|
|
c480ed |
+ if (rc < 0) {
|
|
|
c480ed |
+ if (rc == -2) {
|
|
|
c480ed |
+ virResetLastError();
|
|
|
c480ed |
+ VIR_DEBUG("failed to enable '%s' controller, skipping",
|
|
|
c480ed |
+ virCgroupV2ControllerTypeToString(i));
|
|
|
c480ed |
+ group->unified.controllers &= ~(1 << i);
|
|
|
c480ed |
+ continue;
|
|
|
c480ed |
+ }
|
|
|
c480ed |
return -1;
|
|
|
c480ed |
+ }
|
|
|
c480ed |
}
|
|
|
c480ed |
}
|
|
|
c480ed |
}
|
|
|
c480ed |
--
|
|
|
c480ed |
2.22.0
|
|
|
c480ed |
|