]> xenbits.xensource.com Git - libvirt.git/commitdiff
util: vircgroupv2: mark only requested controllers as available
authorPavel Hrdina <phrdina@redhat.com>
Sat, 22 Jun 2019 11:46:22 +0000 (13:46 +0200)
committerPavel Hrdina <phrdina@redhat.com>
Wed, 26 Jun 2019 11:34:01 +0000 (13:34 +0200)
When detecting available controllers on host we can be limited by list
of controllers from qemu.conf file.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
src/util/vircgroupv2.c

index 3cf786b123e2d23be042f52fe16df29a9c9bf1f4..502afb0b5600b90c3b8143204781d5ef52ca1666 100644 (file)
@@ -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;
 }