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
6fe65606
Commit
6fe65606
authored
Aug 17, 2016
by
Christian Brauner
Committed by
GitHub
Aug 17, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1122 from Blub/rcfile-as-common-arg
Rcfile as common arg
parents
91e7dd57
6f94152d
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
222 additions
and
12 deletions
+222
-12
common_options.sgml.in
doc/common_options.sgml.in
+15
-0
arguments.c
src/lxc/arguments.c
+1
-0
arguments.h
src/lxc/arguments.h
+2
-0
lxc_attach.c
src/lxc/tools/lxc_attach.c
+6
-0
lxc_cgroup.c
src/lxc/tools/lxc_cgroup.c
+17
-1
lxc_checkpoint.c
src/lxc/tools/lxc_checkpoint.c
+16
-0
lxc_console.c
src/lxc/tools/lxc_console.c
+17
-1
lxc_copy.c
src/lxc/tools/lxc_copy.c
+15
-1
lxc_destroy.c
src/lxc/tools/lxc_destroy.c
+17
-1
lxc_device.c
src/lxc/tools/lxc_device.c
+15
-1
lxc_execute.c
src/lxc/tools/lxc_execute.c
+0
-0
lxc_freeze.c
src/lxc/tools/lxc_freeze.c
+17
-1
lxc_info.c
src/lxc/tools/lxc_info.c
+17
-1
lxc_ls.c
src/lxc/tools/lxc_ls.c
+0
-0
lxc_snapshot.c
src/lxc/tools/lxc_snapshot.c
+17
-1
lxc_stop.c
src/lxc/tools/lxc_stop.c
+15
-1
lxc_top.c
src/lxc/tools/lxc_top.c
+1
-1
lxc_unfreeze.c
src/lxc/tools/lxc_unfreeze.c
+17
-1
lxc_usernsexec.c
src/lxc/tools/lxc_usernsexec.c
+0
-0
lxc_wait.c
src/lxc/tools/lxc_wait.c
+17
-1
No files found.
doc/common_options.sgml.in
View file @
6fe65606
...
@@ -107,6 +107,21 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
...
@@ -107,6 +107,21 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
</varlistentry>
</varlistentry>
<varlistentry>
<varlistentry>
<term><option>--rcfile=<replaceable>FILE</replaceable></option></term>
<listitem>
<para>
Specify the configuration file to configure the virtualization
and isolation functionalities for the container.
</para>
<para>
This configuration file if present will be used even if there is
already a configuration file present in the previously created
container (via lxc-create).
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--version</option></term>
<term><option>--version</option></term>
<listitem>
<listitem>
<para>
<para>
...
...
src/lxc/arguments.c
View file @
6fe65606
...
@@ -203,6 +203,7 @@ extern int lxc_arguments_parse(struct lxc_arguments *args,
...
@@ -203,6 +203,7 @@ extern int lxc_arguments_parse(struct lxc_arguments *args,
case
'o'
:
args
->
log_file
=
optarg
;
break
;
case
'o'
:
args
->
log_file
=
optarg
;
break
;
case
'l'
:
args
->
log_priority
=
optarg
;
break
;
case
'l'
:
args
->
log_priority
=
optarg
;
break
;
case
'q'
:
args
->
quiet
=
1
;
break
;
case
'q'
:
args
->
quiet
=
1
;
break
;
case
OPT_RCFILE
:
args
->
rcfile
=
optarg
;
break
;
case
'P'
:
case
'P'
:
remove_trailing_slashes
(
optarg
);
remove_trailing_slashes
(
optarg
);
ret
=
lxc_arguments_lxcpath_add
(
args
,
optarg
);
ret
=
lxc_arguments_lxcpath_add
(
args
,
optarg
);
...
...
src/lxc/arguments.h
View file @
6fe65606
...
@@ -151,11 +151,13 @@ struct lxc_arguments {
...
@@ -151,11 +151,13 @@ struct lxc_arguments {
{"logfile", required_argument, 0, 'o'}, \
{"logfile", required_argument, 0, 'o'}, \
{"logpriority", required_argument, 0, 'l'}, \
{"logpriority", required_argument, 0, 'l'}, \
{"lxcpath", required_argument, 0, 'P'}, \
{"lxcpath", required_argument, 0, 'P'}, \
{"rcfile", required_argument, 0, OPT_RCFILE}, \
{0, 0, 0, 0}
{0, 0, 0, 0}
/* option keys for long only options */
/* option keys for long only options */
#define OPT_USAGE 0x1000
#define OPT_USAGE 0x1000
#define OPT_VERSION OPT_USAGE-1
#define OPT_VERSION OPT_USAGE-1
#define OPT_RCFILE OPT_USAGE-2
extern
int
lxc_arguments_parse
(
struct
lxc_arguments
*
args
,
extern
int
lxc_arguments_parse
(
struct
lxc_arguments
*
args
,
int
argc
,
char
*
const
argv
[]);
int
argc
,
char
*
const
argv
[]);
...
...
src/lxc/tools/lxc_attach.c
View file @
6fe65606
...
@@ -385,6 +385,12 @@ int main(int argc, char *argv[])
...
@@ -385,6 +385,12 @@ int main(int argc, char *argv[])
lxc_container_put
(
c
);
lxc_container_put
(
c
);
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
c
->
configfile
=
strdup
(
my_args
.
rcfile
);
if
(
!
c
->
configfile
)
{
ERROR
(
"Out of memory setting new config filename"
);
lxc_container_put
(
c
);
exit
(
EXIT_FAILURE
);
}
}
}
if
(
!
c
->
may_control
(
c
))
{
if
(
!
c
->
may_control
(
c
))
{
...
...
src/lxc/tools/lxc_cgroup.c
View file @
6fe65606
...
@@ -56,7 +56,8 @@ Get or set the value of a state object (for example, 'cpuset.cpus')\n\
...
@@ -56,7 +56,8 @@ Get or set the value of a state object (for example, 'cpuset.cpus')\n\
in the container's cgroup for the corresponding subsystem.
\n
\
in the container's cgroup for the corresponding subsystem.
\n
\
\n
\
\n
\
Options :
\n
\
Options :
\n
\
-n, --name=NAME NAME of the container"
,
-n, --name=NAME NAME of the container
\n
\
--rcfile=FILE Load configuration file FILE
\n
"
,
.
options
=
my_longopts
,
.
options
=
my_longopts
,
.
parser
=
NULL
,
.
parser
=
NULL
,
.
checker
=
my_checker
,
.
checker
=
my_checker
,
...
@@ -84,6 +85,21 @@ int main(int argc, char *argv[])
...
@@ -84,6 +85,21 @@ int main(int argc, char *argv[])
if
(
!
c
)
if
(
!
c
)
return
1
;
return
1
;
if
(
my_args
.
rcfile
)
{
c
->
clear_config
(
c
);
if
(
!
c
->
load_config
(
c
,
my_args
.
rcfile
))
{
ERROR
(
"Failed to load rcfile"
);
lxc_container_put
(
c
);
return
1
;
}
c
->
configfile
=
strdup
(
my_args
.
rcfile
);
if
(
!
c
->
configfile
)
{
ERROR
(
"Out of memory setting new config filename"
);
lxc_container_put
(
c
);
return
1
;
}
}
if
(
!
c
->
may_control
(
c
))
{
if
(
!
c
->
may_control
(
c
))
{
ERROR
(
"Insufficent privileges to control %s:%s"
,
my_args
.
lxcpath
[
0
],
my_args
.
name
);
ERROR
(
"Insufficent privileges to control %s:%s"
,
my_args
.
lxcpath
[
0
],
my_args
.
name
);
lxc_container_put
(
c
);
lxc_container_put
(
c
);
...
...
src/lxc/tools/lxc_checkpoint.c
View file @
6fe65606
...
@@ -114,6 +114,7 @@ Options :\n\
...
@@ -114,6 +114,7 @@ Options :\n\
Restore options:
\n
\
Restore options:
\n
\
-d, --daemon Daemonize the container (default)
\n
\
-d, --daemon Daemonize the container (default)
\n
\
-F, --foreground Start with the current tty attached to /dev/console
\n
\
-F, --foreground Start with the current tty attached to /dev/console
\n
\
--rcfile=FILE Load configuration file FILE
\n
\
"
,
"
,
.
options
=
my_longopts
,
.
options
=
my_longopts
,
.
parser
=
my_parser
,
.
parser
=
my_parser
,
...
@@ -214,6 +215,21 @@ int main(int argc, char *argv[])
...
@@ -214,6 +215,21 @@ int main(int argc, char *argv[])
exit
(
1
);
exit
(
1
);
}
}
if
(
my_args
.
rcfile
)
{
c
->
clear_config
(
c
);
if
(
!
c
->
load_config
(
c
,
my_args
.
rcfile
))
{
fprintf
(
stderr
,
"Failed to load rcfile
\n
"
);
lxc_container_put
(
c
);
exit
(
1
);
}
c
->
configfile
=
strdup
(
my_args
.
rcfile
);
if
(
!
c
->
configfile
)
{
fprintf
(
stderr
,
"Out of memory setting new config filename
\n
"
);
lxc_container_put
(
c
);
exit
(
1
);
}
}
if
(
!
c
->
may_control
(
c
))
{
if
(
!
c
->
may_control
(
c
))
{
fprintf
(
stderr
,
"Insufficent privileges to control %s
\n
"
,
my_args
.
name
);
fprintf
(
stderr
,
"Insufficent privileges to control %s
\n
"
,
my_args
.
name
);
lxc_container_put
(
c
);
lxc_container_put
(
c
);
...
...
src/lxc/tools/lxc_console.c
View file @
6fe65606
...
@@ -80,7 +80,8 @@ lxc-console logs on the container with the identifier NAME\n\
...
@@ -80,7 +80,8 @@ lxc-console logs on the container with the identifier NAME\n\
Options :
\n
\
Options :
\n
\
-n, --name=NAME NAME of the container
\n
\
-n, --name=NAME NAME of the container
\n
\
-t, --tty=NUMBER console tty number
\n
\
-t, --tty=NUMBER console tty number
\n
\
-e, --escape=PREFIX prefix for escape command
\n
"
,
-e, --escape=PREFIX prefix for escape command
\n
\
--rcfile=FILE Load configuration file FILE
\n
"
,
.
options
=
my_longopts
,
.
options
=
my_longopts
,
.
parser
=
my_parser
,
.
parser
=
my_parser
,
.
checker
=
NULL
,
.
checker
=
NULL
,
...
@@ -112,6 +113,21 @@ int main(int argc, char *argv[])
...
@@ -112,6 +113,21 @@ int main(int argc, char *argv[])
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
if
(
my_args
.
rcfile
)
{
c
->
clear_config
(
c
);
if
(
!
c
->
load_config
(
c
,
my_args
.
rcfile
))
{
fprintf
(
stderr
,
"Failed to load rcfile
\n
"
);
lxc_container_put
(
c
);
exit
(
EXIT_FAILURE
);
}
c
->
configfile
=
strdup
(
my_args
.
rcfile
);
if
(
!
c
->
configfile
)
{
fprintf
(
stderr
,
"Out of memory setting new config filename
\n
"
);
lxc_container_put
(
c
);
exit
(
EXIT_FAILURE
);
}
}
if
(
!
c
->
may_control
(
c
))
{
if
(
!
c
->
may_control
(
c
))
{
fprintf
(
stderr
,
"Insufficent privileges to control %s
\n
"
,
my_args
.
name
);
fprintf
(
stderr
,
"Insufficent privileges to control %s
\n
"
,
my_args
.
name
);
lxc_container_put
(
c
);
lxc_container_put
(
c
);
...
...
src/lxc/tools/lxc_copy.c
View file @
6fe65606
...
@@ -126,7 +126,8 @@ Options :\n\
...
@@ -126,7 +126,8 @@ Options :\n\
-D, --keedata pass together with -e start a persistent snapshot
\n
\
-D, --keedata pass together with -e start a persistent snapshot
\n
\
-K, --keepname keep the hostname of the original container
\n
\
-K, --keepname keep the hostname of the original container
\n
\
-- hook options arguments passed to the hook program
\n
\
-- hook options arguments passed to the hook program
\n
\
-M, --keepmac keep the MAC address of the original container
\n
"
,
-M, --keepmac keep the MAC address of the original container
\n
\
--rcfile=FILE Load configuration file FILE
\n
"
,
.
options
=
my_longopts
,
.
options
=
my_longopts
,
.
parser
=
my_parser
,
.
parser
=
my_parser
,
.
task
=
CLONE
,
.
task
=
CLONE
,
...
@@ -210,6 +211,19 @@ int main(int argc, char *argv[])
...
@@ -210,6 +211,19 @@ int main(int argc, char *argv[])
if
(
!
c
)
if
(
!
c
)
exit
(
ret
);
exit
(
ret
);
if
(
my_args
.
rcfile
)
{
c
->
clear_config
(
c
);
if
(
!
c
->
load_config
(
c
,
my_args
.
rcfile
))
{
fprintf
(
stderr
,
"Failed to load rcfile
\n
"
);
goto
out
;
}
c
->
configfile
=
strdup
(
my_args
.
rcfile
);
if
(
!
c
->
configfile
)
{
fprintf
(
stderr
,
"Out of memory setting new config filename
\n
"
);
goto
out
;
}
}
if
(
!
c
->
may_control
(
c
))
{
if
(
!
c
->
may_control
(
c
))
{
if
(
!
my_args
.
quiet
)
if
(
!
my_args
.
quiet
)
fprintf
(
stderr
,
"Insufficent privileges to control %s
\n
"
,
c
->
name
);
fprintf
(
stderr
,
"Insufficent privileges to control %s
\n
"
,
c
->
name
);
...
...
src/lxc/tools/lxc_destroy.c
View file @
6fe65606
...
@@ -53,7 +53,8 @@ lxc-destroy destroys a container with the identifier NAME\n\
...
@@ -53,7 +53,8 @@ lxc-destroy destroys a container with the identifier NAME\n\
Options :
\n
\
Options :
\n
\
-n, --name=NAME NAME of the container
\n
\
-n, --name=NAME NAME of the container
\n
\
-s, --snapshots destroy including all snapshots
\n
\
-s, --snapshots destroy including all snapshots
\n
\
-f, --force wait for the container to shut down
\n
"
,
-f, --force wait for the container to shut down
\n
\
--rcfile=FILE Load configuration file FILE
\n
"
,
.
options
=
my_longopts
,
.
options
=
my_longopts
,
.
parser
=
my_parser
,
.
parser
=
my_parser
,
.
checker
=
NULL
,
.
checker
=
NULL
,
...
@@ -88,6 +89,21 @@ int main(int argc, char *argv[])
...
@@ -88,6 +89,21 @@ int main(int argc, char *argv[])
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
if
(
my_args
.
rcfile
)
{
c
->
clear_config
(
c
);
if
(
!
c
->
load_config
(
c
,
my_args
.
rcfile
))
{
fprintf
(
stderr
,
"Failed to load rcfile
\n
"
);
lxc_container_put
(
c
);
exit
(
EXIT_FAILURE
);
}
c
->
configfile
=
strdup
(
my_args
.
rcfile
);
if
(
!
c
->
configfile
)
{
fprintf
(
stderr
,
"Out of memory setting new config filename
\n
"
);
lxc_container_put
(
c
);
exit
(
EXIT_FAILURE
);
}
}
if
(
!
c
->
may_control
(
c
))
{
if
(
!
c
->
may_control
(
c
))
{
if
(
!
quiet
)
if
(
!
quiet
)
fprintf
(
stderr
,
"Insufficent privileges to control %s
\n
"
,
my_args
.
name
);
fprintf
(
stderr
,
"Insufficent privileges to control %s
\n
"
,
my_args
.
name
);
...
...
src/lxc/tools/lxc_device.c
View file @
6fe65606
...
@@ -53,7 +53,8 @@ static struct lxc_arguments my_args = {
...
@@ -53,7 +53,8 @@ static struct lxc_arguments my_args = {
lxc-device attach or detach DEV to or from container.
\n
\
lxc-device attach or detach DEV to or from container.
\n
\
\n
\
\n
\
Options :
\n
\
Options :
\n
\
-n, --name=NAME NAME of the container"
,
-n, --name=NAME NAME of the container
\n
\
--rcfile=FILE Load configuration file FILE
\n
"
,
.
options
=
my_longopts
,
.
options
=
my_longopts
,
.
parser
=
NULL
,
.
parser
=
NULL
,
.
checker
=
NULL
,
.
checker
=
NULL
,
...
@@ -125,6 +126,19 @@ int main(int argc, char *argv[])
...
@@ -125,6 +126,19 @@ int main(int argc, char *argv[])
goto
err
;
goto
err
;
}
}
if
(
my_args
.
rcfile
)
{
c
->
clear_config
(
c
);
if
(
!
c
->
load_config
(
c
,
my_args
.
rcfile
))
{
ERROR
(
"Failed to load rcfile"
);
goto
err1
;
}
c
->
configfile
=
strdup
(
my_args
.
rcfile
);
if
(
!
c
->
configfile
)
{
ERROR
(
"Out of memory setting new config filename"
);
goto
err1
;
}
}
if
(
!
c
->
is_running
(
c
))
{
if
(
!
c
->
is_running
(
c
))
{
ERROR
(
"Container %s is not running."
,
c
->
name
);
ERROR
(
"Container %s is not running."
,
c
->
name
);
goto
err1
;
goto
err1
;
...
...
src/lxc/tools/lxc_execute.c
View file @
6fe65606
src/lxc/tools/lxc_freeze.c
View file @
6fe65606
...
@@ -47,7 +47,8 @@ static struct lxc_arguments my_args = {
...
@@ -47,7 +47,8 @@ static struct lxc_arguments my_args = {
lxc-freeze freezes a container with the identifier NAME
\n
\
lxc-freeze freezes a container with the identifier NAME
\n
\
\n
\
\n
\
Options :
\n
\
Options :
\n
\
-n, --name=NAME NAME of the container"
,
-n, --name=NAME NAME of the container
\n
\
--rcfile=FILE Load configuration file FILE
\n
"
,
.
options
=
my_longopts
,
.
options
=
my_longopts
,
.
parser
=
NULL
,
.
parser
=
NULL
,
.
checker
=
NULL
,
.
checker
=
NULL
,
...
@@ -74,6 +75,21 @@ int main(int argc, char *argv[])
...
@@ -74,6 +75,21 @@ int main(int argc, char *argv[])
exit
(
1
);
exit
(
1
);
}
}
if
(
my_args
.
rcfile
)
{
c
->
clear_config
(
c
);
if
(
!
c
->
load_config
(
c
,
my_args
.
rcfile
))
{
ERROR
(
"Failed to load rcfile"
);
lxc_container_put
(
c
);
exit
(
1
);
}
c
->
configfile
=
strdup
(
my_args
.
rcfile
);
if
(
!
c
->
configfile
)
{
ERROR
(
"Out of memory setting new config filename"
);
lxc_container_put
(
c
);
exit
(
1
);
}
}
if
(
!
c
->
may_control
(
c
))
{
if
(
!
c
->
may_control
(
c
))
{
ERROR
(
"Insufficent privileges to control %s:%s"
,
my_args
.
lxcpath
[
0
],
my_args
.
name
);
ERROR
(
"Insufficent privileges to control %s:%s"
,
my_args
.
lxcpath
[
0
],
my_args
.
name
);
lxc_container_put
(
c
);
lxc_container_put
(
c
);
...
...
src/lxc/tools/lxc_info.c
View file @
6fe65606
...
@@ -93,7 +93,8 @@ Options :\n\
...
@@ -93,7 +93,8 @@ Options :\n\
-p, --pid shows the process id of the init container
\n
\
-p, --pid shows the process id of the init container
\n
\
-S, --stats shows usage stats
\n
\
-S, --stats shows usage stats
\n
\
-H, --no-humanize shows stats as raw numbers, not humanized
\n
\
-H, --no-humanize shows stats as raw numbers, not humanized
\n
\
-s, --state shows the state of the container
\n
"
,
-s, --state shows the state of the container
\n
\
--rcfile=FILE Load configuration file FILE
\n
"
,
.
name
=
NULL
,
.
name
=
NULL
,
.
options
=
my_longopts
,
.
options
=
my_longopts
,
.
parser
=
my_parser
,
.
parser
=
my_parser
,
...
@@ -295,6 +296,21 @@ static int print_info(const char *name, const char *lxcpath)
...
@@ -295,6 +296,21 @@ static int print_info(const char *name, const char *lxcpath)
return
-
1
;
return
-
1
;
}
}
if
(
my_args
.
rcfile
)
{
c
->
clear_config
(
c
);
if
(
!
c
->
load_config
(
c
,
my_args
.
rcfile
))
{
fprintf
(
stderr
,
"Failed to load rcfile
\n
"
);
lxc_container_put
(
c
);
return
-
1
;
}
c
->
configfile
=
strdup
(
my_args
.
rcfile
);
if
(
!
c
->
configfile
)
{
fprintf
(
stderr
,
"Out of memory setting new config filename
\n
"
);
lxc_container_put
(
c
);
return
-
1
;
}
}
if
(
!
c
->
may_control
(
c
))
{
if
(
!
c
->
may_control
(
c
))
{
fprintf
(
stderr
,
"Insufficent privileges to control %s
\n
"
,
c
->
name
);
fprintf
(
stderr
,
"Insufficent privileges to control %s
\n
"
,
c
->
name
);
lxc_container_put
(
c
);
lxc_container_put
(
c
);
...
...
src/lxc/tools/lxc_ls.c
View file @
6fe65606
src/lxc/tools/lxc_snapshot.c
View file @
6fe65606
...
@@ -62,7 +62,8 @@ Options :\n\
...
@@ -62,7 +62,8 @@ Options :\n\
-d, --destroy=NAME destroy snapshot NAME, e.g. 'snap0'
\n
\
-d, --destroy=NAME destroy snapshot NAME, e.g. 'snap0'
\n
\
use ALL to destroy all snapshots
\n
\
use ALL to destroy all snapshots
\n
\
-c, --comment=FILE add FILE as a comment
\n
\
-c, --comment=FILE add FILE as a comment
\n
\
-C, --showcomments show snapshot comments
\n
"
,
-C, --showcomments show snapshot comments
\n
\
--rcfile=FILE Load configuration file FILE
\n
"
,
.
options
=
my_longopts
,
.
options
=
my_longopts
,
.
parser
=
my_parser
,
.
parser
=
my_parser
,
.
checker
=
NULL
,
.
checker
=
NULL
,
...
@@ -107,6 +108,21 @@ int main(int argc, char *argv[])
...
@@ -107,6 +108,21 @@ int main(int argc, char *argv[])
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
if
(
my_args
.
rcfile
)
{
c
->
clear_config
(
c
);
if
(
!
c
->
load_config
(
c
,
my_args
.
rcfile
))
{
fprintf
(
stderr
,
"Failed to load rcfile
\n
"
);
lxc_container_put
(
c
);
exit
(
EXIT_FAILURE
);
}
c
->
configfile
=
strdup
(
my_args
.
rcfile
);
if
(
!
c
->
configfile
)
{
fprintf
(
stderr
,
"Out of memory setting new config filename
\n
"
);
lxc_container_put
(
c
);
exit
(
EXIT_FAILURE
);
}
}
if
(
!
c
->
may_control
(
c
))
{
if
(
!
c
->
may_control
(
c
))
{
fprintf
(
stderr
,
"Insufficent privileges to control %s
\n
"
,
fprintf
(
stderr
,
"Insufficent privileges to control %s
\n
"
,
my_args
.
name
);
my_args
.
name
);
...
...
src/lxc/tools/lxc_stop.c
View file @
6fe65606
...
@@ -75,7 +75,8 @@ Options :\n\
...
@@ -75,7 +75,8 @@ Options :\n\
-t, --timeout=T wait T seconds before hard-stopping
\n
\
-t, --timeout=T wait T seconds before hard-stopping
\n
\
-k, --kill kill container rather than request clean shutdown
\n
\
-k, --kill kill container rather than request clean shutdown
\n
\
--nolock Avoid using API locks
\n
\
--nolock Avoid using API locks
\n
\
--nokill Only request clean shutdown, don't force kill after timeout
\n
"
,
--nokill Only request clean shutdown, don't force kill after timeout
\n
\
--rcfile=FILE Load configuration file FILE
\n
"
,
.
options
=
my_longopts
,
.
options
=
my_longopts
,
.
parser
=
my_parser
,
.
parser
=
my_parser
,
.
checker
=
NULL
,
.
checker
=
NULL
,
...
@@ -203,6 +204,19 @@ int main(int argc, char *argv[])
...
@@ -203,6 +204,19 @@ int main(int argc, char *argv[])
goto
out
;
goto
out
;
}
}
if
(
my_args
.
rcfile
)
{
c
->
clear_config
(
c
);
if
(
!
c
->
load_config
(
c
,
my_args
.
rcfile
))
{
fprintf
(
stderr
,
"Failed to load rcfile
\n
"
);
goto
out
;
}
c
->
configfile
=
strdup
(
my_args
.
rcfile
);
if
(
!
c
->
configfile
)
{
fprintf
(
stderr
,
"Out of memory setting new config filename
\n
"
);
goto
out
;
}
}
if
(
!
c
->
may_control
(
c
))
{
if
(
!
c
->
may_control
(
c
))
{
fprintf
(
stderr
,
"Insufficent privileges to control %s
\n
"
,
c
->
name
);
fprintf
(
stderr
,
"Insufficent privileges to control %s
\n
"
,
c
->
name
);
goto
out
;
goto
out
;
...
...
src/lxc/tools/lxc_top.c
View file @
6fe65606
...
@@ -91,7 +91,7 @@ static const struct option my_longopts[] = {
...
@@ -91,7 +91,7 @@ static const struct option my_longopts[] = {
static
struct
lxc_arguments
my_args
=
{
static
struct
lxc_arguments
my_args
=
{
.
progname
=
"lxc-top"
,
.
progname
=
"lxc-top"
,
.
help
=
"\
.
help
=
"\
[--name=NAME]
\n
\
\n
\
\n
\
\n
\
lxc-top monitors the state of the active containers
\n
\
lxc-top monitors the state of the active containers
\n
\
\n
\
\n
\
...
...
src/lxc/tools/lxc_unfreeze.c
View file @
6fe65606
...
@@ -45,7 +45,8 @@ static struct lxc_arguments my_args = {
...
@@ -45,7 +45,8 @@ static struct lxc_arguments my_args = {
lxc-unfreeze unfreezes a container with the identifier NAME
\n
\
lxc-unfreeze unfreezes a container with the identifier NAME
\n
\
\n
\
\n
\
Options :
\n
\
Options :
\n
\
-n, --name=NAME NAME of the container
\n
"
,
-n, --name=NAME NAME of the container
\n
\
--rcfile=FILE Load configuration file FILE
\n
"
,
.
options
=
my_longopts
,
.
options
=
my_longopts
,
.
parser
=
NULL
,
.
parser
=
NULL
,
.
checker
=
NULL
,
.
checker
=
NULL
,
...
@@ -78,6 +79,21 @@ int main(int argc, char *argv[])
...
@@ -78,6 +79,21 @@ int main(int argc, char *argv[])
exit
(
1
);
exit
(
1
);
}
}
if
(
my_args
.
rcfile
)
{
c
->
clear_config
(
c
);
if
(
!
c
->
load_config
(
c
,
my_args
.
rcfile
))
{
ERROR
(
"Failed to load rcfile"
);
lxc_container_put
(
c
);
exit
(
1
);
}
c
->
configfile
=
strdup
(
my_args
.
rcfile
);
if
(
!
c
->
configfile
)
{
ERROR
(
"Out of memory setting new config filename"
);
lxc_container_put
(
c
);
exit
(
1
);
}
}
if
(
!
c
->
unfreeze
(
c
))
{
if
(
!
c
->
unfreeze
(
c
))
{
ERROR
(
"Failed to unfreeze %s:%s"
,
my_args
.
lxcpath
[
0
],
my_args
.
name
);
ERROR
(
"Failed to unfreeze %s:%s"
,
my_args
.
lxcpath
[
0
],
my_args
.
name
);
lxc_container_put
(
c
);
lxc_container_put
(
c
);
...
...
src/lxc/tools/lxc_usernsexec.c
View file @
6fe65606
src/lxc/tools/lxc_wait.c
View file @
6fe65606
...
@@ -72,7 +72,8 @@ Options :\n\
...
@@ -72,7 +72,8 @@ Options :\n\
-s, --state=STATE ORed states to wait for
\n
\
-s, --state=STATE ORed states to wait for
\n
\
STOPPED, STARTING, RUNNING, STOPPING,
\n
\
STOPPED, STARTING, RUNNING, STOPPING,
\n
\
ABORTING, FREEZING, FROZEN, THAWED
\n
\
ABORTING, FREEZING, FROZEN, THAWED
\n
\
-t, --timeout=TMO Seconds to wait for state changes
\n
"
,
-t, --timeout=TMO Seconds to wait for state changes
\n
\
--rcfile=FILE Load configuration file FILE
\n
"
,
.
options
=
my_longopts
,
.
options
=
my_longopts
,
.
parser
=
my_parser
,
.
parser
=
my_parser
,
.
checker
=
my_checker
,
.
checker
=
my_checker
,
...
@@ -104,6 +105,21 @@ int main(int argc, char *argv[])
...
@@ -104,6 +105,21 @@ int main(int argc, char *argv[])
return
1
;
return
1
;
}
}
if
(
my_args
.
rcfile
)
{
c
->
clear_config
(
c
);
if
(
!
c
->
load_config
(
c
,
my_args
.
rcfile
))
{
fprintf
(
stderr
,
"Failed to load rcfile
\n
"
);
lxc_container_put
(
c
);
return
1
;
}
c
->
configfile
=
strdup
(
my_args
.
rcfile
);
if
(
!
c
->
configfile
)
{
fprintf
(
stderr
,
"Out of memory setting new config filename
\n
"
);
lxc_container_put
(
c
);
return
1
;
}
}
if
(
!
c
->
wait
(
c
,
my_args
.
states
,
my_args
.
timeout
))
{
if
(
!
c
->
wait
(
c
,
my_args
.
states
,
my_args
.
timeout
))
{
lxc_container_put
(
c
);
lxc_container_put
(
c
);
return
1
;
return
1
;
...
...
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