Commit 93884589 by Serge E. Hallyn Committed by Daniel Lezcano

fix lxc-ls with mtab != /proc/mounts

The cgroup mounts created by cgroup-bin do not show up in /etc/mtab. lxc-ls, as lxc-ps before it, assumes that /etc/mtab is symlinked to /proc/mounts. Author: Serge Hallyn <serge.hallyn@canonical.com> Forwarded: no Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/819319Signed-off-by: 's avatarDaniel Lezcano <dlezcano@fr.ibm.com>
parent 3729572b
......@@ -10,12 +10,16 @@ function get_cgroup()
{
local mount_string
mount_string=$(mount -t cgroup |grep -E -e '^lxc ')
if test -z "$mount_string"; then
mount_string=$(mount |grep -m1 'type cgroup')
fi
if test -n "$mount_string"; then
mount_point=$(echo $mount_string |cut -d' ' -f3)
return
fi
mount_string=`grep -m1 -E '^[^ \t]+[ \t]+[^ \t]+[ \t]+cgroup' /proc/self/mounts`;
if test -z "$mount_string"; then
echo "failed to find mounted cgroup"
exit 1
fi
mount_point=`echo "$mount_string" |cut -d' ' -f2`;
}
ls "$@" $lxcpath
......
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