Would it be possible to add an option to lxc list in order to specify the project of interest or for all projects? For example:
situation#1: I have three projects (one, two three) and the current is one, but I want to see lxc list for the project two without typing lxc project switch two and then lxc list.
situation#2: I have three projects (one, two three) and the current is one, but I want to see lxc list for all projects in order to see all containers in the host (maybe with one column showing the project to which it belongs)
Suggestion #1 should be easy conceptually, and it seems it makes sense. Ideally, in that case we’d have add --project flag to all commands, not just lxc list, but lxc list might be a sensible start.
Suggestion #2 would be a bit more problematic, and we should consider how it would play with a possible RBAC functionality that LXD should eventually grow.
Hi,
Suggestion #1: great!!
Suggestion #2: OK. For the moment I created an alias command to see all containers from all projects. IIt’s not cool but it works:
$ alias lxc_ls='for i in `lxc project list | grep -v NAME | grep "|" |cut -d "|" -f2 | cut -d "(" -f 1`; do echo $i; lxc project switch $i; lxc ls -c n,4,s,P,S,l ; done'
$ lxc_ls
ESC3E
+---------------+------------------------+---------+----------+-----------+----------------------+
| NAME | IPV4 | STATE | PROFILES | SNAPSHOTS | LAST USED AT |
+---------------+------------------------+---------+----------+-----------+----------------------+
| admin2 | 192.168.100.2 (eth0) | RUNNING | lan | | 2018/11/09 07:02 UTC |
+---------------+------------------------+---------+----------+-----------+----------------------+
| fw | 192.168.100.254 (eth1) | RUNNING | 3NICs | | 2018/11/09 07:02 UTC |
| | 192.0.2.254 (eth0) | | | | |
| | 172.16.255.254 (eth2) | | | | |
+---------------+------------------------+---------+----------+-----------+----------------------+
| medusa32 | 192.0.2.127 (eth0) | RUNNING | wan | | 2018/11/09 07:02 UTC |
+---------------+------------------------+---------+----------+-----------+----------------------+
| medusa64 | | STOPPED | lan | | 2018/11/07 00:50 UTC |
+---------------+------------------------+---------+----------+-----------+----------------------+
| server-medusa | | STOPPED | lan | | 2018/11/04 15:01 UTC |
+---------------+------------------------+---------+----------+-----------+----------------------+
| server-ssh | | STOPPED | lan | | 2018/11/04 14:09 UTC |
+---------------+------------------------+---------+----------+-----------+----------------------+
| serverdmz | 172.16.0.2 (eth0) | RUNNING | dmz | | 2018/11/09 07:02 UTC |
+---------------+------------------------+---------+----------+-----------+----------------------+
default
+----------------+------+---------+------------+-----------+----------------------+
| NAME | IPV4 | STATE | PROFILES | SNAPSHOTS | LAST USED AT |
+----------------+------+---------+------------+-----------+----------------------+
| fw-linux | | STOPPED | WAN-LAN | | 2018/10/18 14:36 UTC |
+----------------+------+---------+------------+-----------+----------------------+
| fw-linux2 | | STOPPED | WAN-LAN | | 2018/10/26 17:37 UTC |
+----------------+------+---------+------------+-----------+----------------------+
| gui1604 | | STOPPED | wan | | 2018/11/01 16:57 UTC |
| | | | gui | | |
+----------------+------+---------+------------+-----------+----------------------+
| gui2 | | STOPPED | default | | 2018/10/21 20:35 UTC |
| | | | gui | | |
+----------------+------+---------+------------+-----------+----------------------+
| haproxy | | STOPPED | HAProxy | | 2018/11/06 21:48 UTC |
+----------------+------+---------+------------+-----------+----------------------+
| haproxy-php-01 | | STOPPED | intHAProxy | | 2018/11/06 21:48 UTC |
+----------------+------+---------+------------+-----------+----------------------+
| haproxy-php-02 | | STOPPED | intHAProxy | | 2018/11/06 21:48 UTC |
+----------------+------+---------+------------+-----------+----------------------+
| haproxy-php-03 | | STOPPED | intHAProxy | | 2018/11/06 21:48 UTC |
+----------------+------+---------+------------+-----------+----------------------+
| haproxy-php-04 | | STOPPED | intHAProxy | | 2018/11/06 21:48 UTC |
+----------------+------+---------+------------+-----------+----------------------+
| haproxy-php-05 | | STOPPED | intHAProxy | | 2018/11/06 21:49 UTC |
+----------------+------+---------+------------+-----------+----------------------+