To cover all the cases we have around, we need to:
- Attempt to use cgm if present (preferred)
- Attempt to use cgmanager directly over dbus otherwise
- Fallback to cgroupfs
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge Hallyn <serge.hallyn@ubuntu.com>
cd $HDIR
-if [ -e /sys/fs/cgroup/cgmanager/sock ]; then
+if which cgm >/dev/null 2>&1; then
+ cgm create all $TUSER
+ cgm chown all $TUSER $(id -u $TUSER) $(id -g $TUSER)
+ cgm movepid all $TUSER $$
+elif [ -e /sys/fs/cgroup/cgmanager/sock ]; then
for d in $(cut -d : -f 2 /proc/self/cgroup); do
dbus-send --print-reply --address=unix:path=/sys/fs/cgroup/cgmanager/sock \
--type=method_call /org/linuxcontainers/cgmanager org.linuxcontainers.cgmanager0_0.Create \
lxc.id_map = g 0 910000 10000
EOF
-if [ -e /sys/fs/cgroup/cgmanager/sock ]; then
+if which cgm >/dev/null 2>&1; then
+ cgm create all $TUSER
+ cgm chown all $TUSER $(id -u $TUSER) $(id -g $TUSER)
+ cgm movepid all $TUSER $$
+elif [ -e /sys/fs/cgroup/cgmanager/sock ]; then
for d in $(cut -d : -f 2 /proc/self/cgroup); do
dbus-send --print-reply --address=unix:path=/sys/fs/cgroup/cgmanager/sock \
--type=method_call /org/linuxcontainers/cgmanager org.linuxcontainers.cgmanager0_0.Create \