Ah, I see the problem.  This is fix released in quantal, but is still
broken in precise.  The fix is to switch 'netstat -xa' with 'netstat
-xl'.  We'll get that SRU'd.

Thanks again for the bug report.

** Also affects: lxc (Ubuntu Precise)
   Importance: Undecided
       Status: New

** Changed in: lxc (Ubuntu)
       Status: New => Fix Released

** Changed in: lxc (Ubuntu Precise)
       Status: New => In Progress

** Changed in: lxc (Ubuntu Precise)
   Importance: Undecided => Low

** Changed in: lxc (Ubuntu Precise)
     Assignee: (unassigned) => Serge Hallyn (serge-hallyn)

** Description changed:

+ ====================
+ 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_1204-temp-NjwI1BQ  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  ubu12-bb-01-ubu12
  
  Lessee: lxc-ls does
  active=$(netstat -xa 2>/dev/null | grep $lxcpath | \
-         sed -e 's#.*'"$lxcpath/"'\(.*\)/command#\1#');
+         sed -e 's#.*'"$lxcpath/"'\(.*\)/command#\1#');
  
  which expands to
  
  ++ netstat -xa
  ++ grep /var/lib/lxc
  ++ sed -e 's#.*/var/lib/lxc/\(.*\)/command#\1#'
  + 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
  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/lxc/ubu12-bb-01-ubu12/command
  unix  2      [ ]         STREAM     CONNECTING    0        
@/var/lib/lxc/ubu12-bb-01-ubu12/command
  unix  2      [ ]         STREAM     CONNECTING    0        
@/var/lib/lxc/ubu12-bb-01-ubu12/command
  unix  3      [ ]         STREAM     CONNECTING    0        
@/var/lib/lxc/ubu12-bb-01-ubu12/command
  
- So,  perhaps that should be grep "LISTENING.*$lxcpath" ?
+ So,  perhaps that should be grep "LISTENING.*$lxcpath"

-- 
You received this bug notification because you are a member of Ubuntu
Server Team, which is subscribed to lxc in Ubuntu.
https://bugs.launchpad.net/bugs/1043018

Title:
  lxc-ls lists running containers multiple times

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/1043018/+subscriptions

-- 
Ubuntu-server-bugs mailing list
Ubuntu-server-bugs@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/ubuntu-server-bugs

Reply via email to