render / rpms / libvirt

Forked from rpms/libvirt 11 months ago
Clone
Pablo Greco 40546a
From 54d26cd3d6839c67970d19559aaa13294c55f9a0 Mon Sep 17 00:00:00 2001
Pablo Greco 40546a
Message-Id: <54d26cd3d6839c67970d19559aaa13294c55f9a0@dist-git>
Pablo Greco 40546a
From: Pavel Hrdina <phrdina@redhat.com>
Pablo Greco 40546a
Date: Mon, 1 Jul 2019 17:08:22 +0200
Pablo Greco 40546a
Subject: [PATCH] util: vircgroupv2: mark only requested controllers as
Pablo Greco 40546a
 available
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
When detecting available controllers on host we can be limited by list
Pablo Greco 40546a
of controllers from qemu.conf file.
Pablo Greco 40546a
Pablo Greco 40546a
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Pablo Greco 40546a
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Pablo Greco 40546a
(cherry picked from commit 05807e5d42f23832ab7dab17fb7e51b48b0a7c7b)
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: <40e05984144af026205a123c5b0f9cb841dcec67.1561993100.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 | 8 ++++----
Pablo Greco 40546a
 1 file changed, 4 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 e1ab1849ba..bdeab397a3 100644
Pablo Greco 40546a
--- a/src/util/vircgroupv2.c
Pablo Greco 40546a
+++ b/src/util/vircgroupv2.c
Pablo Greco 40546a
@@ -301,15 +301,15 @@ virCgroupV2DetectControllers(virCgroupPtr group,
Pablo Greco 40546a
         group->unified.controllers |= 1 << VIR_CGROUP_CONTROLLER_CPUACCT;
Pablo Greco 40546a
     }
Pablo Greco 40546a
 
Pablo Greco 40546a
+    if (controllers >= 0)
Pablo Greco 40546a
+        group->unified.controllers &= controllers;
Pablo Greco 40546a
+
Pablo Greco 40546a
     for (i = 0; i < VIR_CGROUP_CONTROLLER_LAST; i++)
Pablo Greco 40546a
         VIR_DEBUG("Controller '%s' present=%s",
Pablo Greco 40546a
                   virCgroupV2ControllerTypeToString(i),
Pablo Greco 40546a
                   (group->unified.controllers & 1 << i) ? "yes" : "no");
Pablo Greco 40546a
 
Pablo Greco 40546a
-    if (controllers >= 0)
Pablo Greco 40546a
-        return controllers & group->unified.controllers;
Pablo Greco 40546a
-    else
Pablo Greco 40546a
-        return group->unified.controllers;
Pablo Greco 40546a
+    return group->unified.controllers;
Pablo Greco 40546a
 }
Pablo Greco 40546a
 
Pablo Greco 40546a
 
Pablo Greco 40546a
-- 
Pablo Greco 40546a
2.22.0
Pablo Greco 40546a