lxc-ls lists running containers multiple times
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
lxc (Ubuntu) |
Fix Released
|
Low
|
Unassigned | ||
Precise |
Fix Released
|
Low
|
Unassigned |
Bug Description
=======
SRU Justification:
1. Impact: lxc-ls output can have duplicates.
2. Development fix: use 'netstat -xl' in place of 'netstat -xa' to only show listening sockets
3. Stable fix: same as development fix
4. Test case: start a container, open a second console (with lxc-console -n <containername>). Then do 'lxc-ls' and look for duplicate entries in the second line.
5. Regression potential: none.
=======
This seems wrong:
$ lxc-ls
demo_centos5 demo_centos6 demofedora16 demo_ubuntu_1004 demo_ubuntu_1204 demo_ubuntu_
ubu12-bb-01-ubu12 ubu12-bb-01-ubu12 ubu12-bb-01-ubu12 ubu12-bb-01-ubu12 ubu12-bb-01-ubu12 ubu12-bb-01-ubu12 ubu12-bb-01-ubu12 ubu12-bb-01-ubu12
ubu12-bb-01-ubu12 ubu12-bb-01-ubu12 ubu12-bb-01-ubu12 ubu12-bb-01-ubu12 ubu12-bb-01-ubu12 ubu12-bb-01-ubu12 ubu12-bb-01-ubu12 ubu12-bb-01-ubu12
Lessee: lxc-ls does
active=$(netstat -xa 2>/dev/null | grep $lxcpath | \
sed -e 's#.*'"
which expands to
++ netstat -xa
++ grep /var/lib/lxc
++ sed -e 's#.*/var/
+ active=
ubu12-bb-01-ubu12
ubu12-bb-01-ubu12
ubu12-bb-01-ubu12
ubu12-bb-01-ubu12
ubu12-bb-01-ubu12
ubu12-bb-01-ubu12
...
netstat -xa | grep /var/lib/lxc shows
$ netstat -xa | grep /var/lib/lxc
unix 2 [ ACC ] STREAM LISTENING 1509155 @/var/lib/
unix 2 [ ] STREAM CONNECTING 0 @/var/lib/
unix 2 [ ] STREAM CONNECTING 0 @/var/lib/
unix 3 [ ] STREAM CONNECTING 0 @/var/lib/
So, perhaps that should be grep "LISTENING.
Changed in lxc (Ubuntu): | |
status: | Incomplete → New |
Changed in lxc (Ubuntu Precise): | |
status: | Triaged → In Progress |
tags: |
added: verification-done removed: needsru verification-needed |
Thanks for reporting this bug.
I actually cannot reproduce this (on Ubuntu quantal). I have 'q1' started with an additional console opened, but lxc-ls shows:
serge@amd1:~$ sudo lxc-ls
b1 b2 bb1 p1 q1
q1
Is there somethign else I should be doing to reproduce this?
Can you tell us which release you are on, which lxc version you are using, and the container configuration file?