]> git.ipfire.org Git - thirdparty/lxc.git/commit
define list container api (v2)
authorSerge Hallyn <serge.hallyn@ubuntu.com>
Fri, 11 Oct 2013 15:44:39 +0000 (10:44 -0500)
committerSerge Hallyn <serge.hallyn@ubuntu.com>
Mon, 14 Oct 2013 17:42:39 +0000 (12:42 -0500)
commita41f104bfbd69e5f068e5ca312a2eb513d9e81b8
tree96090ed3b39a1701c9e3464a86643c96f53a2650
parentf3cef1cbe2835668036d40bc88c2e546868bc0ea
define list container api (v2)

Two new commands are defined: list_defined_containers() and
list_active_containers().  Both take an lxcpath (NULL means
use the default lxcpath) and return the number of containers
found.  If a lxc_container ** is passed in, then an array of
lxc_container's is returned, one for each container found.
The caller must then lxc_container_put() each container and
free the array, as shown in the new list testcase.
If a char ** is passed in, then an array of container names
is returned, after which the caller must free all the names
and the name array, as showsn in the testcase.

Changelog:
Check for the container config file before trying to
create an lxc_container *, to save some work. [ per
stgraber comments]
Add names ** argument to return only container names.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
.gitignore
src/lxc/lxccontainer.c
src/lxc/lxccontainer.h
src/tests/Makefile.am
src/tests/list.c [new file with mode: 0644]