render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
c480ed
From aa699de198c52868d08679176dd8355deb24ef82 Mon Sep 17 00:00:00 2001
c480ed
Message-Id: <aa699de198c52868d08679176dd8355deb24ef82@dist-git>
c480ed
From: Pavel Hrdina <phrdina@redhat.com>
c480ed
Date: Mon, 1 Jul 2019 17:08:19 +0200
c480ed
Subject: [PATCH] util: vircgroupv2: enable CPU controller only if it's
c480ed
 available
c480ed
MIME-Version: 1.0
c480ed
Content-Type: text/plain; charset=UTF-8
c480ed
Content-Transfer-Encoding: 8bit
c480ed
c480ed
It might happen that we are not able to enable CPU controller so we
c480ed
can enable it for thread sub-cgroups only if it's available in parent
c480ed
cgroup.
c480ed
c480ed
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
c480ed
Reviewed-by: Ján Tomko <jtomko@redhat.com>
c480ed
(cherry picked from commit f9d1c08557ddb981a0d889200431185a9c4920e0)
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: <2a13e05dfbbe52f05541c881964ce92709e5d36a.1561993100.git.phrdina@redhat.com>
c480ed
Reviewed-by: Ján Tomko <jtomko@redhat.com>
c480ed
---
c480ed
 src/util/vircgroupv2.c | 3 ++-
c480ed
 1 file changed, 2 insertions(+), 1 deletion(-)
c480ed
c480ed
diff --git a/src/util/vircgroupv2.c b/src/util/vircgroupv2.c
c480ed
index 04cbadd6a6..98d313bf82 100644
c480ed
--- a/src/util/vircgroupv2.c
c480ed
+++ b/src/util/vircgroupv2.c
c480ed
@@ -403,7 +403,8 @@ virCgroupV2MakeGroup(virCgroupPtr parent ATTRIBUTE_UNUSED,
c480ed
                 return -1;
c480ed
             }
c480ed
 
c480ed
-            if (virCgroupV2EnableController(parent,
c480ed
+            if (virCgroupV2HasController(parent, VIR_CGROUP_CONTROLLER_CPU) &&
c480ed
+                virCgroupV2EnableController(parent,
c480ed
                                             VIR_CGROUP_CONTROLLER_CPU) < 0) {
c480ed
                 return -1;
c480ed
             }
c480ed
-- 
c480ed
2.22.0
c480ed