[lxc-devel] [PATCH] Rewrite lxc-ls in python

Stéphane Graber stgraber at ubuntu.com
Wed Nov 21 23:09:16 UTC 2012


On 11/21/2012 06:04 PM, Stéphane Graber wrote:
> This rewrite is mostly compatible with the shell version.
> --active and -1 still work and behave as they used to.
> 
> This adds --running, --stopped and --frozen as state filters.
> 
> A new "fancy" view is also implemented (can be used with --fancy) and
> will show containers in a column-based interface with the following fields:
>  - name
>  - state
>  - ipv4
>  - ipv6
>  - pid of init
> 
> Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
> ---

I figured some people may want examples, there you go:


root at castiana:~$ lxc-ls
edubuntu01         tpl-oneiric-amd64  tpl-quantal-armel
juju               tpl-oneiric-i386   tpl-quantal-armhf
precise-gui        tpl-precise-amd64  tpl-quantal-i386
qatracker01        tpl-precise-armel  tpl-raring-amd64
stgraber-steam     tpl-precise-armhf  tpl-raring-armel
tpl-lucid-amd64    tpl-precise-i386   tpl-raring-armhf
tpl-lucid-i386     tpl-quantal-amd64  tpl-raring-i386

root at castiana:~$ lxc-ls -1 --active
qatracker01

root at castiana:~$ lxc-ls --fancy
NAME               STATE    IPV4        IPV6
--------------------------------------------
edubuntu01         STOPPED  -           -
juju               STOPPED  -           -
precise-gui        STOPPED  -           -
qatracker01        RUNNING  10.0.3.149  -
stgraber-steam     STOPPED  -           -
tpl-lucid-amd64    STOPPED  -           -
tpl-lucid-i386     STOPPED  -           -
tpl-oneiric-amd64  STOPPED  -           -
tpl-oneiric-i386   STOPPED  -           -
tpl-precise-amd64  STOPPED  -           -
tpl-precise-armel  STOPPED  -           -
tpl-precise-armhf  STOPPED  -           -
tpl-precise-i386   STOPPED  -           -
tpl-quantal-amd64  STOPPED  -           -
tpl-quantal-armel  STOPPED  -           -
tpl-quantal-armhf  STOPPED  -           -
tpl-quantal-i386   STOPPED  -           -
tpl-raring-amd64   STOPPED  -           -
tpl-raring-armel   STOPPED  -           -
tpl-raring-armhf   STOPPED  -           -
tpl-raring-i386    STOPPED  -           -

root at castiana:~$ lxc-ls --running --fancy --fancy-format=name,ipv4
NAME         IPV4
-----------------------
qatracker01  10.0.3.149



-- 
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 899 bytes
Desc: OpenPGP digital signature
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20121121/5ba4b694/attachment.pgp>


More information about the lxc-devel mailing list