Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lxc
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
lxc
Commits
c6f7b951
Commit
c6f7b951
authored
Jul 02, 2017
by
Christian Brauner
Committed by
GitHub
Jul 02, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1591 from grzgrzgrz3/regres-lxc-ls
lxc-ls: return all containers by default, new filter - list only defi…
parents
05e7cd4a
c2e1b07a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
1 deletion
+21
-1
lxc-ls.sgml.in
doc/lxc-ls.sgml.in
+12
-0
arguments.h
src/lxc/arguments.h
+1
-0
lxc_ls.c
src/lxc/tools/lxc_ls.c
+8
-1
No files found.
doc/lxc-ls.sgml.in
View file @
c6f7b951
...
@@ -55,6 +55,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
...
@@ -55,6 +55,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
<arg choice="opt">--frozen</arg>
<arg choice="opt">--frozen</arg>
<arg choice="opt">--running</arg>
<arg choice="opt">--running</arg>
<arg choice="opt">--stopped</arg>
<arg choice="opt">--stopped</arg>
<arg choice="opt">--defined</arg>
<arg choice="opt">-f</arg>
<arg choice="opt">-f</arg>
<arg choice="opt">-F <replaceable>format</replaceable></arg>
<arg choice="opt">-F <replaceable>format</replaceable></arg>
<arg choice="opt">-g <replaceable>groups</replaceable></arg>
<arg choice="opt">-g <replaceable>groups</replaceable></arg>
...
@@ -131,6 +132,17 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
...
@@ -131,6 +132,17 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
<varlistentry>
<varlistentry>
<term>
<term>
<option>--defined</option>
</term>
<listitem>
<para>
List only defined containers.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-f,--fancy</option>
<option>-f,--fancy</option>
</term>
</term>
<listitem>
<listitem>
...
...
src/lxc/arguments.h
View file @
c6f7b951
...
@@ -130,6 +130,7 @@ struct lxc_arguments {
...
@@ -130,6 +130,7 @@ struct lxc_arguments {
bool
ls_line
;
bool
ls_line
;
bool
ls_running
;
bool
ls_running
;
bool
ls_stopped
;
bool
ls_stopped
;
bool
ls_defined
;
/* lxc-copy */
/* lxc-copy */
bool
tmpfs
;
bool
tmpfs
;
...
...
src/lxc/tools/lxc_ls.c
View file @
c6f7b951
...
@@ -53,6 +53,7 @@ lxc_log_define(lxc_ls, lxc);
...
@@ -53,6 +53,7 @@ lxc_log_define(lxc_ls, lxc);
#define LS_RUNNING 4
#define LS_RUNNING 4
#define LS_NESTING 5
#define LS_NESTING 5
#define LS_FILTER 6
#define LS_FILTER 6
#define LS_DEFINED 7
#ifndef SOCK_CLOEXEC
#ifndef SOCK_CLOEXEC
# define SOCK_CLOEXEC 02000000
# define SOCK_CLOEXEC 02000000
...
@@ -167,6 +168,7 @@ static const struct option my_longopts[] = {
...
@@ -167,6 +168,7 @@ static const struct option my_longopts[] = {
{
"running"
,
no_argument
,
0
,
LS_RUNNING
},
{
"running"
,
no_argument
,
0
,
LS_RUNNING
},
{
"frozen"
,
no_argument
,
0
,
LS_FROZEN
},
{
"frozen"
,
no_argument
,
0
,
LS_FROZEN
},
{
"stopped"
,
no_argument
,
0
,
LS_STOPPED
},
{
"stopped"
,
no_argument
,
0
,
LS_STOPPED
},
{
"defined"
,
no_argument
,
0
,
LS_DEFINED
},
{
"nesting"
,
optional_argument
,
0
,
LS_NESTING
},
{
"nesting"
,
optional_argument
,
0
,
LS_NESTING
},
{
"groups"
,
required_argument
,
0
,
'g'
},
{
"groups"
,
required_argument
,
0
,
'g'
},
{
"filter"
,
required_argument
,
0
,
LS_FILTER
},
{
"filter"
,
required_argument
,
0
,
LS_FILTER
},
...
@@ -192,6 +194,7 @@ Options :\n\
...
@@ -192,6 +194,7 @@ Options :\n\
--running list only running containers
\n
\
--running list only running containers
\n
\
--frozen list only frozen containers
\n
\
--frozen list only frozen containers
\n
\
--stopped list only stopped containers
\n
\
--stopped list only stopped containers
\n
\
--defined list only defined containers
\n
\
--nesting=NUM list nested containers up to NUM (default is 5) levels of nesting
\n
\
--nesting=NUM list nested containers up to NUM (default is 5) levels of nesting
\n
\
--filter=REGEX filter container names by regular expression
\n
\
--filter=REGEX filter container names by regular expression
\n
\
-g --groups comma separated list of groups a container must have to be displayed
\n
"
,
-g --groups comma separated list of groups a container must have to be displayed
\n
"
,
...
@@ -402,8 +405,9 @@ static int ls_get(struct ls **m, size_t *size, const struct lxc_arguments *args,
...
@@ -402,8 +405,9 @@ static int ls_get(struct ls **m, size_t *size, const struct lxc_arguments *args,
else
if
(
!
c
)
else
if
(
!
c
)
continue
;
continue
;
if
(
!
c
->
is_defined
(
c
))
if
(
args
->
ls_defined
&&
!
c
->
is_defined
(
c
)){
goto
put_and_next
;
goto
put_and_next
;
}
/* This does not allocate memory so no worries about freeing it
/* This does not allocate memory so no worries about freeing it
* when we goto next or out. */
* when we goto next or out. */
...
@@ -935,6 +939,9 @@ static int my_parser(struct lxc_arguments *args, int c, char *arg)
...
@@ -935,6 +939,9 @@ static int my_parser(struct lxc_arguments *args, int c, char *arg)
case
LS_STOPPED
:
case
LS_STOPPED
:
args
->
ls_stopped
=
true
;
args
->
ls_stopped
=
true
;
break
;
break
;
case
LS_DEFINED
:
args
->
ls_defined
=
true
;
break
;
case
LS_NESTING
:
case
LS_NESTING
:
/* In case strtoul() receives a string that represents a
/* In case strtoul() receives a string that represents a
* negative number it will return ULONG_MAX - the number that
* negative number it will return ULONG_MAX - the number that
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment