[lxc-users] Feature request: raw lxc utilities output format and operations with multiplie containers?

Stéphane Graber stgraber at ubuntu.com
Thu Nov 10 14:56:59 UTC 2016


On Thu, Nov 10, 2016 at 02:36:55PM +0000, Andriy Tovstik wrote:
> Thanks, Stéphane, i'm very inattentive... Now it looks better. Additional
> output format seems to be more comfortable than additional tools. But it
> insignificantly.
> 
> And what do you think about the second question about ability to run
> commands on multiplie containers simultaneously using regexps as container
> name ? Is this feature looks useful?

We've had some requests for it before and do support passing multiple
container names for most non-interactive commands (start, stop, delete, ...).

Passing wildcards is a bit annoying because you need to escape them in
your shell for them to work out, I seem to remember they also believe
kinda weird on Windows (where our client does work), but I'm not
otherwise opposed to them if someone can find a sane, multi-platform way
to have them without causing other regressions.

For exec, the problem will be the mixed output you'd get from all the
containers running the commands at the same time, with effectively the
same terminal attached to them.

> 
> 
> чт, 10 нояб. 2016 г. в 15:25, Stéphane Graber <stgraber at ubuntu.com>:
> 
> > stgraber at castiana:~$ lxc list --format=json | jq .[].name
> > "android"
> > "lxd"
> > "snapcraft"
> > "test"
> > "ubuntu-core"
> > "ubuntu-zesty"
> > "xen"
> > "yak"
> >
> > On Thu, Nov 10, 2016 at 12:31:01PM +0000, Andriy Tovstik wrote:
> > > Hi, Janjaap Bos!
> > >
> > > I tried jq. But as i have already wrote, some useful fileds like
> > container
> > > name are missing in json output...
> > >
> > > чт, 10 нояб. 2016 г. в 14:27, Janjaap Bos <janjaapbos at gmail.com>:
> > >
> > > > You can pipe the json through jq.
> > > >
> > > > See: https://stedolan.github.io/jq/tutorial
> > > >
> > > >
> > > > 2016-11-10 11:17 GMT+01:00 Andriy Tovstik <andriy.tovstik at gmail.com>:
> > > >
> > > > Hi all!
> > > >
> > > > During LXD learning i encountered with lack of some features.
> > > >
> > > > The first one is "raw" output format of lxc list. Currently lxc list
> > > > supports two formats: table and json. Unfortunately both formats are
> > > > unusable for scripting.
> > > > It is very difficult to pass to script output likes:
> > > > # lxc list --format table -c n
> > > > +------------+
> > > > |    NAME    |
> > > > +------------+
> > > > | mysql-rep1 |
> > > > +------------+
> > > > | mysql-rep2 |
> > > > +------------+
> > > > | mysql-rep3 |
> > > > +------------+
> > > >
> > > > When i try to use json format i see that useful fields like container
> > name
> > > > are missing in output. May be it will be useful to implement feature
> > like:
> > > >
> > > > # lxc list --format raw -c n --no-header
> > > > mysql-rep1
> > > > mysql-rep2
> > > > mysql-rep3
> > > >
> > > > The second feature looks useful is ability run commands on multiplie
> > > > containers simultaneously. For example:
> > > >
> > > > # lxc exec web-node* -- apt update
> > > >
> > > > What do you think about it?
> > > > --
> > > > WBR, Andriy Tovstik
> > > >
> > > > _______________________________________________
> > > > lxc-users mailing list
> > > > lxc-users at lists.linuxcontainers.org
> > > > http://lists.linuxcontainers.org/listinfo/lxc-users
> > > >
> > > >
> > > > _______________________________________________
> > > > lxc-users mailing list
> > > > lxc-users at lists.linuxcontainers.org
> > > > http://lists.linuxcontainers.org/listinfo/lxc-users
> > >
> > > --
> > > WBR, Andriy Tovstik
> >
> > > _______________________________________________
> > > lxc-users mailing list
> > > lxc-users at lists.linuxcontainers.org
> > > http://lists.linuxcontainers.org/listinfo/lxc-users
> >
> >
> > --
> > Stéphane Graber
> > Ubuntu developer
> > http://www.ubuntu.com
> > _______________________________________________
> > lxc-users mailing list
> > lxc-users at lists.linuxcontainers.org
> > http://lists.linuxcontainers.org/listinfo/lxc-users
> 
> -- 
> WBR, Andriy Tovstik

> _______________________________________________
> lxc-users mailing list
> lxc-users at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-users


-- 
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: 801 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20161110/ffca791d/attachment-0001.sig>


More information about the lxc-users mailing list