]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
tools: add additional cgroup checks
authorChristian Brauner <christian.brauner@ubuntu.com>
Tue, 22 Aug 2017 12:22:21 +0000 (14:22 +0200)
committerStéphane Graber <stgraber@ubuntu.com>
Tue, 29 Aug 2017 18:02:21 +0000 (14:02 -0400)
- list all cgroup v1 mountpoints
- list all cgroup v2 mountpoints
- report "missing" when no mountpoint for the systemd controller was found
- report "missing" when no mountpoint for the freezer controller was found

Closes https://github.com/lxc/lxd/issues/3687.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/tools/lxc-checkconfig.in

index 1dc6ec872280804050a9ca029a17dc74c3f79c2d..61681ee127b8378e7d607edc5a85c4fa7902b68e 100644 (file)
@@ -128,30 +128,59 @@ if ([ $KVER_MAJOR -lt 4 ]) || ([ $KVER_MAJOR -eq 4 ] && [ $KVER_MINOR -lt 7 ]);
        echo -n "Multiple /dev/pts instances: " && is_enabled DEVPTS_MULTIPLE_INSTANCES
 fi
 echo
+
 echo "--- Control groups ---"
 
+echo -n "Cgroups: " && is_enabled CONFIG_CGROUPS
+echo
+
 print_cgroups() {
   # print all mountpoints for cgroup filesystems
   awk '$1 !~ /#/ && $3 == mp { print $2; } ; END { exit(0); } '  "mp=$1" "$2" ;
 }
 
-CGROUP_MNT_PATH=`print_cgroups cgroup /proc/self/mounts | head -n 1`
+CGROUP_V1_MNTS=`print_cgroups cgroup /proc/self/mounts`
+echo
+echo "Cgroup v1 mount points: "
+echo "$CGROUP_V1_MNTS"
+echo
 
-echo -n "Cgroup: " && is_enabled CONFIG_CGROUPS
+CGROUP_V2_MNTS=`print_cgroups cgroup2 /proc/self/mounts`
+echo "Cgroup v2 mount points: "
+echo "$CGROUP_V2_MNTS"
 echo
 
+CGROUP_SYSTEMD_MNTPT=`echo "$CGROUP_V1_MNTS" | grep "/systemd"`
+if [ -z "$CGROUP_SYSTEMD_MNTPT" ]; then
+    echo -n "Cgroup v1 systemd controller: "
+    "$SETCOLOR_FAILURE" && echo -n "missing" && $SETCOLOR_NORMAL
+    echo
+fi
+
+CGROUP_FREEZER_MNTPT=`echo "$CGROUP_V1_MNTS" | grep "/freezer"`
+if [ -z "$CGROUP_FREEZER_MNTPT" ]; then
+    echo -n "Cgroup v1 freezer controller: "
+    "$SETCOLOR_FAILURE" && echo -n "missing" && $SETCOLOR_NORMAL
+    echo
+fi
+
+CGROUP_MNT_PATH=`echo "$CGROUP_V1_MNTS" | head -n 1`
 if [ -f $CGROUP_MNT_PATH/cgroup.clone_children ]; then
-    echo -n "Cgroup clone_children flag: " &&
+    echo -n "Cgroup v1 clone_children flag: " &&
     $SETCOLOR_SUCCESS && echo "enabled" && $SETCOLOR_NORMAL
 else
     echo -n "Cgroup namespace: " && is_enabled CONFIG_CGROUP_NS yes
 fi
+
 echo -n "Cgroup device: " && is_enabled CONFIG_CGROUP_DEVICE
 echo
+
 echo -n "Cgroup sched: " && is_enabled CONFIG_CGROUP_SCHED
 echo
+
 echo -n "Cgroup cpu account: " && is_enabled CONFIG_CGROUP_CPUACCT
 echo
+
 echo -n "Cgroup memory controller: "
 if ([ $KVER_MAJOR -ge 3 ] && [ $KVER_MINOR -ge 6 ]) || ([ $KVER_MAJOR -gt 3 ]); then
     is_enabled CONFIG_MEMCG
@@ -159,8 +188,10 @@ else
     is_enabled CONFIG_CGROUP_MEM_RES_CTLR
 fi
 echo
+
 is_set CONFIG_SMP && echo -n "Cgroup cpuset: " && is_enabled CONFIG_CPUSETS && echo
 echo
+
 echo "--- Misc ---"
 echo -n "Veth pair device: " && is_enabled CONFIG_VETH && is_probed veth
 echo