On Fri, 2011-07-15 at 15:18 +0200, Joerg Gollnick wrote: > Dear all, > while working with systemd I found that lxc-ps -efa does not recognize the > container name. > Best regards Joerg
Tested on my F15 host. Patch fixes the problem with lxc-ps for me too. Regards, Mike > diff --git a/src/lxc/lxc-ps.in b/src/lxc/lxc-ps.in > index 249b104..4ef2296 100755 > --- a/src/lxc/lxc-ps.in > +++ b/src/lxc/lxc-ps.in > @@ -37,7 +37,7 @@ our %LXC_NAMES; # Specified container names (if any) > > sub get_container_names { > my $ref_names = shift; > - my $lxcpath='@LXCPATH@'; > + my $lxcpath = '@LXCPATH@'; > > open(active, "netstat -xa | grep $lxcpath |") or return; > while(<active>) { > @@ -112,13 +112,18 @@ sub get_container { > my $pid = shift; > my $filename = "/proc/$pid/cgroup"; > open(LXC, "$filename"); > - my $container = <LXC>; > + # read all lines at once > + my @cgroup = <LXC>; > close LXC; > - chomp($container); > - if ($container =~ m/[:,]ns[:,]/o) { > - $container =~ s/.*:\///o; > - } else { > - $container =''; > + my $container = ''; > + foreach ( @cgroup ) { > + chomp; > + # find the container name > + if (m/[:,]ns[:,]/o) { > + # container name after :/ > + s/.*:\///o; > + $container = $_; > + } > } > return $container; > } > > > > > > ------------------------------------------------------------------------------ > AppSumo Presents a FREE Video for the SourceForge Community by Eric > Ries, the creator of the Lean Startup Methodology on "Lean Startup > Secrets Revealed." This video shows you how to validate your ideas, > optimize your ideas and identify your business strategy. > http://p.sf.net/sfu/appsumosfdev2dev > _______________________________________________ > Lxc-devel mailing list > Lxc-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/lxc-devel > -- Michael H. Warfield (AI4NB) | (770) 985-6132 | m...@wittsend.com /\/\|=mhw=|\/\/ | (678) 463-0932 | http://www.wittsend.com/mhw/ NIC whois: MHW9 | An optimist believes we live in the best of all PGP Key: 0x674627FF | possible worlds. A pessimist is sure of it!
signature.asc
Description: This is a digitally signed message part
------------------------------------------------------------------------------ AppSumo Presents a FREE Video for the SourceForge Community by Eric Ries, the creator of the Lean Startup Methodology on "Lean Startup Secrets Revealed." This video shows you how to validate your ideas, optimize your ideas and identify your business strategy. http://p.sf.net/sfu/appsumosfdev2dev
_______________________________________________ Lxc-devel mailing list Lxc-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-devel