]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
Use the cgroup name for cpuset for lxc-ps
authorNick Huber <nicholashuber@gmail.com>
Tue, 31 Dec 2013 20:05:50 +0000 (12:05 -0800)
committerStéphane Graber <stgraber@ubuntu.com>
Mon, 6 Jan 2014 15:34:51 +0000 (10:34 -0500)
On my Ubuntu 13.10 system, lxc-ps was always giving empty output. The
output of /proc/$initpid/cgroup was

11:name=systemd:/user/1000.user/c3.session
10:hugetlb:/container
9:perf_event:/container
8:blkio:/container
7:freezer:/container
6:devices:/container
5:memory:/container
4:cpuacct:/container
3:cpu:/container
2:cpuset:/container

Using the cpuset line should be a safer option.

Signed-off-by: Nick Huber <nicholashuber@gmail.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
src/lxc/lxc-ps.in

index ae57e2140f74fdeaf93ffadf7c2d25f9873f8126..5c6c17568392d5e4afff28d9db15e48e93bb3b33 100644 (file)
@@ -118,7 +118,7 @@ for container in ${containers}; do
 
     if ! lxc-wait -P $lxc_path -s STOPPED -n $container -t 0; then
         initpid=`lxc-info -P $lxc_path -p -n $container | awk -F: '{ print $2 }' | awk '{ print $1 }'`
-        cgroup=`head -n 1 /proc/$initpid/cgroup | awk -F: '{ print $3}'`
+        cgroup=`grep cpuset /proc/$initpid/cgroup | awk -F: '{ print $3}'`
         if [ -f "$parent_cgroup/$cgroup/tasks" ]; then
             tasks_files="$tasks_files $parent_cgroup$cgroup/tasks"
         fi