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
1e764f80
Unverified
Commit
1e764f80
authored
Aug 18, 2018
by
2xsec
Committed by
Christian Brauner
Aug 19, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tools: lxc-stop: add default log priority & cleanups
Signed-off-by:
2xsec
<
dh48.jeong@samsung.com
>
parent
765604fa
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
45 deletions
+46
-45
lxc_stop.c
src/lxc/tools/lxc_stop.c
+46
-45
No files found.
src/lxc/tools/lxc_stop.c
View file @
1e764f80
...
...
@@ -34,36 +34,12 @@
#include "log.h"
#include "utils.h"
#define OPT_NO_LOCK
OPT_USAGE + 1
#define OPT_NO_KILL
OPT_USAGE + 2
#define OPT_NO_LOCK
(OPT_USAGE + 1)
#define OPT_NO_KILL
(OPT_USAGE + 2)
lxc_log_define
(
lxc_stop
,
lxc
);
static
int
my_parser
(
struct
lxc_arguments
*
args
,
int
c
,
char
*
arg
)
{
switch
(
c
)
{
case
'r'
:
args
->
reboot
=
1
;
break
;
case
'W'
:
args
->
nowait
=
1
;
break
;
case
't'
:
if
(
lxc_safe_long
(
arg
,
&
args
->
timeout
)
<
0
)
return
-
1
;
break
;
case
'k'
:
args
->
hardstop
=
1
;
break
;
case
OPT_NO_LOCK
:
args
->
nolock
=
1
;
break
;
case
OPT_NO_KILL
:
args
->
nokill
=
1
;
break
;
}
return
0
;
}
static
int
my_parser
(
struct
lxc_arguments
*
args
,
int
c
,
char
*
arg
);
static
const
struct
option
my_longopts
[]
=
{
{
"reboot"
,
no_argument
,
0
,
'r'
},
...
...
@@ -76,8 +52,8 @@ static const struct option my_longopts[] = {
};
static
struct
lxc_arguments
my_args
=
{
.
progname
=
"lxc-stop"
,
.
help
=
"\
.
progname
=
"lxc-stop"
,
.
help
=
"\
--name=NAME
\n
\
\n
\
lxc-stop stops a container with the identifier NAME
\n
\
...
...
@@ -91,12 +67,40 @@ Options :\n\
--nolock Avoid using API locks
\n
\
--nokill Only request clean shutdown, don't force kill after timeout
\n
\
--rcfile=FILE Load configuration file FILE
\n
"
,
.
options
=
my_longopts
,
.
parser
=
my_parser
,
.
checker
=
NULL
,
.
timeout
=
-
2
,
.
options
=
my_longopts
,
.
parser
=
my_parser
,
.
checker
=
NULL
,
.
log_priority
=
"ERROR"
,
.
log_file
=
"none"
,
.
timeout
=
-
2
,
};
static
int
my_parser
(
struct
lxc_arguments
*
args
,
int
c
,
char
*
arg
)
{
switch
(
c
)
{
case
'r'
:
args
->
reboot
=
1
;
break
;
case
'W'
:
args
->
nowait
=
1
;
break
;
case
't'
:
if
(
lxc_safe_long
(
arg
,
&
args
->
timeout
)
<
0
)
return
-
1
;
break
;
case
'k'
:
args
->
hardstop
=
1
;
break
;
case
OPT_NO_LOCK
:
args
->
nolock
=
1
;
break
;
case
OPT_NO_KILL
:
args
->
nokill
=
1
;
break
;
}
return
0
;
}
int
main
(
int
argc
,
char
*
argv
[])
{
struct
lxc_container
*
c
;
...
...
@@ -107,18 +111,15 @@ int main(int argc, char *argv[])
if
(
lxc_arguments_parse
(
&
my_args
,
argc
,
argv
))
exit
(
ret
);
/* Only create log if explicitly instructed */
if
(
my_args
.
log_file
||
my_args
.
log_priority
)
{
log
.
name
=
my_args
.
name
;
log
.
file
=
my_args
.
log_file
;
log
.
level
=
my_args
.
log_priority
;
log
.
prefix
=
my_args
.
progname
;
log
.
quiet
=
my_args
.
quiet
;
log
.
lxcpath
=
my_args
.
lxcpath
[
0
];
if
(
lxc_log_init
(
&
log
))
exit
(
ret
);
}
log
.
name
=
my_args
.
name
;
log
.
file
=
my_args
.
log_file
;
log
.
level
=
my_args
.
log_priority
;
log
.
prefix
=
my_args
.
progname
;
log
.
quiet
=
my_args
.
quiet
;
log
.
lxcpath
=
my_args
.
lxcpath
[
0
];
if
(
lxc_log_init
(
&
log
))
exit
(
ret
);
/* Set default timeout */
if
(
my_args
.
timeout
==
-
2
)
{
...
...
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