From d6259d368bcf0364abe401d090d69ab930344222 Mon Sep 17 00:00:00 2001 From: Christian Brauner Date: Tue, 22 Aug 2017 14:22:21 +0200 Subject: [PATCH] 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: Christian Brauner --- src/lxc/tools/lxc-checkconfig.in | 37 +++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/src/lxc/tools/lxc-checkconfig.in b/src/lxc/tools/lxc-checkconfig.in index 1dc6ec872..61681ee12 100644 --- a/src/lxc/tools/lxc-checkconfig.in +++ b/src/lxc/tools/lxc-checkconfig.in @@ -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 -- 2.47.2