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
152c0dc8
Unverified
Commit
152c0dc8
authored
Aug 20, 2018
by
2xsec
Committed by
Christian Brauner
Aug 21, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tools: lxc-wait: add default log priority & cleanups
Signed-off-by:
2xsec
<
dh48.jeong@samsung.com
>
parent
bc2c01a1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
36 deletions
+42
-36
lxc_wait.c
src/lxc/tools/lxc_wait.c
+42
-36
No files found.
src/lxc/tools/lxc_wait.c
View file @
152c0dc8
...
@@ -37,25 +37,8 @@
...
@@ -37,25 +37,8 @@
lxc_log_define
(
lxc_wait
,
lxc
);
lxc_log_define
(
lxc_wait
,
lxc
);
static
int
my_checker
(
const
struct
lxc_arguments
*
args
)
static
int
my_parser
(
struct
lxc_arguments
*
args
,
int
c
,
char
*
arg
);
{
static
int
my_checker
(
const
struct
lxc_arguments
*
args
);
if
(
!
args
->
states
)
{
ERROR
(
"Missing state option to wait for"
);
return
-
1
;
}
return
0
;
}
static
int
my_parser
(
struct
lxc_arguments
*
args
,
int
c
,
char
*
arg
)
{
switch
(
c
)
{
case
's'
:
args
->
states
=
optarg
;
break
;
case
't'
:
args
->
timeout
=
atol
(
optarg
);
break
;
}
return
0
;
}
static
const
struct
option
my_longopts
[]
=
{
static
const
struct
option
my_longopts
[]
=
{
{
"state"
,
required_argument
,
0
,
's'
},
{
"state"
,
required_argument
,
0
,
's'
},
...
@@ -64,8 +47,8 @@ static const struct option my_longopts[] = {
...
@@ -64,8 +47,8 @@ static const struct option my_longopts[] = {
};
};
static
struct
lxc_arguments
my_args
=
{
static
struct
lxc_arguments
my_args
=
{
.
progname
=
"lxc-wait"
,
.
progname
=
"lxc-wait"
,
.
help
=
"\
.
help
=
"\
--name=NAME --state=STATE
\n
\
--name=NAME --state=STATE
\n
\
\n
\
\n
\
lxc-wait waits for NAME container state to reach STATE
\n
\
lxc-wait waits for NAME container state to reach STATE
\n
\
...
@@ -77,12 +60,38 @@ Options :\n\
...
@@ -77,12 +60,38 @@ Options :\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
"
,
--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
,
.
timeout
=
-
1
,
.
log_priority
=
"ERROR"
,
.
log_file
=
"none"
,
.
timeout
=
-
1
,
};
};
static
int
my_parser
(
struct
lxc_arguments
*
args
,
int
c
,
char
*
arg
)
{
switch
(
c
)
{
case
's'
:
args
->
states
=
optarg
;
break
;
case
't'
:
args
->
timeout
=
atol
(
optarg
);
break
;
}
return
0
;
}
static
int
my_checker
(
const
struct
lxc_arguments
*
args
)
{
if
(
!
args
->
states
)
{
ERROR
(
"Missing state option to wait for"
);
return
-
1
;
}
return
0
;
}
int
main
(
int
argc
,
char
*
argv
[])
int
main
(
int
argc
,
char
*
argv
[])
{
{
struct
lxc_container
*
c
;
struct
lxc_container
*
c
;
...
@@ -91,18 +100,15 @@ int main(int argc, char *argv[])
...
@@ -91,18 +100,15 @@ int main(int argc, char *argv[])
if
(
lxc_arguments_parse
(
&
my_args
,
argc
,
argv
))
if
(
lxc_arguments_parse
(
&
my_args
,
argc
,
argv
))
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
/* Only create log if explicitly instructed */
log
.
name
=
my_args
.
name
;
if
(
my_args
.
log_file
||
my_args
.
log_priority
)
{
log
.
file
=
my_args
.
log_file
;
log
.
name
=
my_args
.
name
;
log
.
level
=
my_args
.
log_priority
;
log
.
file
=
my_args
.
log_file
;
log
.
prefix
=
my_args
.
progname
;
log
.
level
=
my_args
.
log_priority
;
log
.
quiet
=
my_args
.
quiet
;
log
.
prefix
=
my_args
.
progname
;
log
.
lxcpath
=
my_args
.
lxcpath
[
0
];
log
.
quiet
=
my_args
.
quiet
;
log
.
lxcpath
=
my_args
.
lxcpath
[
0
];
if
(
lxc_log_init
(
&
log
))
if
(
lxc_log_init
(
&
log
))
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
c
=
lxc_container_new
(
my_args
.
name
,
my_args
.
lxcpath
[
0
]);
c
=
lxc_container_new
(
my_args
.
name
,
my_args
.
lxcpath
[
0
]);
if
(
!
c
)
if
(
!
c
)
...
...
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