[PATCH 5/5] util: vircgroupv2: don't error out if enabling controller fails

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Currently CPU controller cannot be enabled if there is any real-time
task running and is assigned to non-root cgroup which is the case on
several distributions with graphical environment.

Instead of erroring out treat it as the controller is not available.

Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx>
---
 src/util/vircgroupv2.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/util/vircgroupv2.c b/src/util/vircgroupv2.c
index 6eeebe2230..9cc64d64d2 100644
--- a/src/util/vircgroupv2.c
+++ b/src/util/vircgroupv2.c
@@ -425,8 +425,13 @@ virCgroupV2MakeGroup(virCgroupPtr parent ATTRIBUTE_UNUSED,
                 if (i == VIR_CGROUP_CONTROLLER_CPUACCT)
                     continue;
 
-                if (virCgroupV2EnableController(parent, i) < 0)
-                    return -1;
+                if (virCgroupV2EnableController(parent, i) < 0) {
+                    virResetLastError();
+                    VIR_DEBUG("failed to enable '%s' controller, skipping",
+                              virCgroupV2ControllerTypeToString(i));
+                    group->unified.controllers &= ~(1 << i);
+                    continue;
+                }
             }
         }
     }
-- 
2.21.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux