From 05807e5d42f23832ab7dab17fb7e51b48b0a7c7b Mon Sep 17 00:00:00 2001 From: Pavel Hrdina Date: Sat, 22 Jun 2019 13:46:22 +0200 Subject: [PATCH] util: vircgroupv2: mark only requested controllers as available When detecting available controllers on host we can be limited by list of controllers from qemu.conf file. Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa --- src/util/vircgroupv2.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/util/vircgroupv2.c b/src/util/vircgroupv2.c index 3cf786b123..502afb0b56 100644 --- a/src/util/vircgroupv2.c +++ b/src/util/vircgroupv2.c @@ -302,15 +302,15 @@ virCgroupV2DetectControllers(virCgroupPtr group, group->unified.controllers |= 1 << VIR_CGROUP_CONTROLLER_CPUACCT; } + if (controllers >= 0) + group->unified.controllers &= controllers; + for (i = 0; i < VIR_CGROUP_CONTROLLER_LAST; i++) VIR_DEBUG("Controller '%s' present=%s", virCgroupV2ControllerTypeToString(i), (group->unified.controllers & 1 << i) ? "yes" : "no"); - if (controllers >= 0) - return controllers & group->unified.controllers; - else - return group->unified.controllers; + return group->unified.controllers; } -- 2.47.2