Blame SOURCES/libvirt-util-vircgroupv2-mark-only-requested-controllers-as-available.patch

c480ed
From 54d26cd3d6839c67970d19559aaa13294c55f9a0 Mon Sep 17 00:00:00 2001
c480ed
Message-Id: <54d26cd3d6839c67970d19559aaa13294c55f9a0@dist-git>
c480ed
From: Pavel Hrdina <phrdina@redhat.com>
c480ed
Date: Mon, 1 Jul 2019 17:08:22 +0200
c480ed
Subject: [PATCH] util: vircgroupv2: mark only requested controllers as
c480ed
 available
c480ed
MIME-Version: 1.0
c480ed
Content-Type: text/plain; charset=UTF-8
c480ed
Content-Transfer-Encoding: 8bit
c480ed
c480ed
When detecting available controllers on host we can be limited by list
c480ed
of controllers from qemu.conf file.
c480ed
c480ed
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
c480ed
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
c480ed
(cherry picked from commit 05807e5d42f23832ab7dab17fb7e51b48b0a7c7b)
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: <40e05984144af026205a123c5b0f9cb841dcec67.1561993100.git.phrdina@redhat.com>
c480ed
Reviewed-by: Ján Tomko <jtomko@redhat.com>
c480ed
---
c480ed
 src/util/vircgroupv2.c | 8 ++++----
c480ed
 1 file changed, 4 insertions(+), 4 deletions(-)
c480ed
c480ed
diff --git a/src/util/vircgroupv2.c b/src/util/vircgroupv2.c
c480ed
index e1ab1849ba..bdeab397a3 100644
c480ed
--- a/src/util/vircgroupv2.c
c480ed
+++ b/src/util/vircgroupv2.c
c480ed
@@ -301,15 +301,15 @@ virCgroupV2DetectControllers(virCgroupPtr group,
c480ed
         group->unified.controllers |= 1 << VIR_CGROUP_CONTROLLER_CPUACCT;
c480ed
     }
c480ed
 
c480ed
+    if (controllers >= 0)
c480ed
+        group->unified.controllers &= controllers;
c480ed
+
c480ed
     for (i = 0; i < VIR_CGROUP_CONTROLLER_LAST; i++)
c480ed
         VIR_DEBUG("Controller '%s' present=%s",
c480ed
                   virCgroupV2ControllerTypeToString(i),
c480ed
                   (group->unified.controllers & 1 << i) ? "yes" : "no");
c480ed
 
c480ed
-    if (controllers >= 0)
c480ed
-        return controllers & group->unified.controllers;
c480ed
-    else
c480ed
-        return group->unified.controllers;
c480ed
+    return group->unified.controllers;
c480ed
 }
c480ed
 
c480ed
 
c480ed
-- 
c480ed
2.22.0
c480ed