tools: add additional cgroup checks

- 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: 's avatarChristian Brauner <christian.brauner@ubuntu.com>
parent 25a908b8
...@@ -128,30 +128,59 @@ if ([ $KVER_MAJOR -lt 4 ]) || ([ $KVER_MAJOR -eq 4 ] && [ $KVER_MINOR -lt 7 ]); ...@@ -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 echo -n "Multiple /dev/pts instances: " && is_enabled DEVPTS_MULTIPLE_INSTANCES
fi fi
echo echo
echo "--- Control groups ---" echo "--- Control groups ---"
echo -n "Cgroups: " && is_enabled CONFIG_CGROUPS
echo
print_cgroups() { print_cgroups() {
# print all mountpoints for cgroup filesystems # print all mountpoints for cgroup filesystems
awk '$1 !~ /#/ && $3 == mp { print $2; } ; END { exit(0); } ' "mp=$1" "$2" ; 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 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 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 $SETCOLOR_SUCCESS && echo "enabled" && $SETCOLOR_NORMAL
else else
echo -n "Cgroup namespace: " && is_enabled CONFIG_CGROUP_NS yes echo -n "Cgroup namespace: " && is_enabled CONFIG_CGROUP_NS yes
fi fi
echo -n "Cgroup device: " && is_enabled CONFIG_CGROUP_DEVICE echo -n "Cgroup device: " && is_enabled CONFIG_CGROUP_DEVICE
echo echo
echo -n "Cgroup sched: " && is_enabled CONFIG_CGROUP_SCHED echo -n "Cgroup sched: " && is_enabled CONFIG_CGROUP_SCHED
echo echo
echo -n "Cgroup cpu account: " && is_enabled CONFIG_CGROUP_CPUACCT echo -n "Cgroup cpu account: " && is_enabled CONFIG_CGROUP_CPUACCT
echo echo
echo -n "Cgroup memory controller: " echo -n "Cgroup memory controller: "
if ([ $KVER_MAJOR -ge 3 ] && [ $KVER_MINOR -ge 6 ]) || ([ $KVER_MAJOR -gt 3 ]); then if ([ $KVER_MAJOR -ge 3 ] && [ $KVER_MINOR -ge 6 ]) || ([ $KVER_MAJOR -gt 3 ]); then
is_enabled CONFIG_MEMCG is_enabled CONFIG_MEMCG
...@@ -159,8 +188,10 @@ else ...@@ -159,8 +188,10 @@ else
is_enabled CONFIG_CGROUP_MEM_RES_CTLR is_enabled CONFIG_CGROUP_MEM_RES_CTLR
fi fi
echo echo
is_set CONFIG_SMP && echo -n "Cgroup cpuset: " && is_enabled CONFIG_CPUSETS && echo is_set CONFIG_SMP && echo -n "Cgroup cpuset: " && is_enabled CONFIG_CPUSETS && echo
echo echo
echo "--- Misc ---" echo "--- Misc ---"
echo -n "Veth pair device: " && is_enabled CONFIG_VETH && is_probed veth echo -n "Veth pair device: " && is_enabled CONFIG_VETH && is_probed veth
echo echo
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment