Skip to content

Commit

Permalink
tools: add additional cgroup checks
Browse files Browse the repository at this point in the history
- 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>
  • Loading branch information
Christian Brauner authored and stgraber committed Aug 29, 2017
1 parent 61993d9 commit 5d20664
Showing 1 changed file with 34 additions and 3 deletions.
37 changes: 34 additions & 3 deletions src/lxc/tools/lxc-checkconfig.in
Expand Up @@ -128,39 +128,70 @@ 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
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
Expand Down

0 comments on commit 5d20664

Please sign in to comment.