]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
cgroups: add check for lxc.cgroup.use
authorMarcos Paulo de Souza <marcos.souza.org@gmail.com>
Thu, 8 Feb 2018 01:55:13 +0000 (23:55 -0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Mon, 12 Feb 2018 16:03:59 +0000 (17:03 +0100)
Closes #870.

Signed-off-by: Marcos Paulo de Souza <marcos.souza.org@gmail.com>
src/lxc/cgroups/cgroup.c

index 1f78a6317e09a229aebf52afd9bf306208c3c084..5491d5c0eca7830516bffcc13bd8378d9b03c68e 100644 (file)
@@ -26,6 +26,7 @@
 
 #include "cgroup.h"
 #include "conf.h"
+#include "initutils.h"
 #include "log.h"
 #include "start.h"
 
@@ -246,9 +247,14 @@ void prune_init_scope(char *cg)
  * is not mounted then it will be ignored. But if systemd is mounted, then it
  * must be setup so that lxc can create cgroups in it, else containers will
  * fail.
+ *
+ * cgroups listed in lxc.cgroup.use are also treated as crucial
+ *
  */
 bool is_crucial_cgroup_subsystem(const char *s)
 {
+       const char *cgroup_use;
+
        if (strcmp(s, "systemd") == 0)
                return true;
 
@@ -258,5 +264,9 @@ bool is_crucial_cgroup_subsystem(const char *s)
        if (strcmp(s, "freezer") == 0)
                return true;
 
+       cgroup_use = lxc_global_config_value("lxc.cgroup.use");
+       if (cgroup_use && strstr(cgroup_use, s))
+               return true;
+
        return false;
 }