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
21773a95
Unverified
Commit
21773a95
authored
Mar 27, 2018
by
Stéphane Graber
Committed by
GitHub
Mar 27, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2239 from brauner/2018-03-27/fixup_action_script
Allow passing action scripts to CRIU
parents
808108a9
59019754
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
3 deletions
+24
-3
lxc_checkpoint.c
src/lxc/tools/lxc_checkpoint.c
+24
-3
No files found.
src/lxc/tools/lxc_checkpoint.c
View file @
21773a95
...
@@ -36,11 +36,13 @@ static bool do_restore = false;
...
@@ -36,11 +36,13 @@ static bool do_restore = false;
static
bool
daemonize_set
=
false
;
static
bool
daemonize_set
=
false
;
static
bool
pre_dump
=
false
;
static
bool
pre_dump
=
false
;
static
char
*
predump_dir
=
NULL
;
static
char
*
predump_dir
=
NULL
;
static
char
*
actionscript_path
=
NULL
;
#define OPT_PREDUMP_DIR OPT_USAGE + 1
#define OPT_PREDUMP_DIR OPT_USAGE + 1
static
const
struct
option
my_longopts
[]
=
{
static
const
struct
option
my_longopts
[]
=
{
{
"checkpoint-dir"
,
required_argument
,
0
,
'D'
},
{
"checkpoint-dir"
,
required_argument
,
0
,
'D'
},
{
"action-script"
,
required_argument
,
0
,
'A'
},
{
"stop"
,
no_argument
,
0
,
's'
},
{
"stop"
,
no_argument
,
0
,
's'
},
{
"verbose"
,
no_argument
,
0
,
'v'
},
{
"verbose"
,
no_argument
,
0
,
'v'
},
{
"restore"
,
no_argument
,
0
,
'r'
},
{
"restore"
,
no_argument
,
0
,
'r'
},
...
@@ -83,6 +85,11 @@ static int my_parser(struct lxc_arguments *args, int c, char *arg)
...
@@ -83,6 +85,11 @@ static int my_parser(struct lxc_arguments *args, int c, char *arg)
if
(
!
checkpoint_dir
)
if
(
!
checkpoint_dir
)
return
-
1
;
return
-
1
;
break
;
break
;
case
'A'
:
actionscript_path
=
strdup
(
arg
);
if
(
!
actionscript_path
)
return
-
1
;
break
;
case
's'
:
case
's'
:
stop
=
true
;
stop
=
true
;
break
;
break
;
...
@@ -126,6 +133,7 @@ Options :\n\
...
@@ -126,6 +133,7 @@ Options :\n\
-r, --restore Restore container
\n
\
-r, --restore Restore container
\n
\
-D, --checkpoint-dir=DIR directory to save the checkpoint in
\n
\
-D, --checkpoint-dir=DIR directory to save the checkpoint in
\n
\
-v, --verbose Enable verbose criu logs
\n
\
-v, --verbose Enable verbose criu logs
\n
\
-A, --action-script=PATH Path to criu action script
\n
\
Checkpoint options:
\n
\
Checkpoint options:
\n
\
-s, --stop Stop the container after checkpointing.
\n
\
-s, --stop Stop the container after checkpointing.
\n
\
-p, --pre-dump Only pre-dump the memory of the container.
\n
\
-p, --pre-dump Only pre-dump the memory of the container.
\n
\
...
@@ -182,13 +190,23 @@ static bool checkpoint(struct lxc_container *c)
...
@@ -182,13 +190,23 @@ static bool checkpoint(struct lxc_container *c)
static
bool
restore_finalize
(
struct
lxc_container
*
c
)
static
bool
restore_finalize
(
struct
lxc_container
*
c
)
{
{
bool
ret
=
c
->
restore
(
c
,
checkpoint_dir
,
verbose
);
struct
migrate_opts
opts
;
if
(
!
ret
)
{
bool
ret
;
memset
(
&
opts
,
0
,
sizeof
(
opts
));
opts
.
directory
=
checkpoint_dir
;
opts
.
verbose
=
verbose
;
opts
.
stop
=
stop
;
opts
.
action_script
=
actionscript_path
;
ret
=
c
->
migrate
(
c
,
MIGRATE_RESTORE
,
&
opts
,
sizeof
(
opts
));
if
(
ret
)
{
fprintf
(
stderr
,
"Restoring %s failed.
\n
"
,
my_args
.
name
);
fprintf
(
stderr
,
"Restoring %s failed.
\n
"
,
my_args
.
name
);
return
false
;
}
}
lxc_container_put
(
c
);
lxc_container_put
(
c
);
return
ret
;
return
true
;
}
}
static
bool
restore
(
struct
lxc_container
*
c
)
static
bool
restore
(
struct
lxc_container
*
c
)
...
@@ -289,6 +307,9 @@ int main(int argc, char *argv[])
...
@@ -289,6 +307,9 @@ int main(int argc, char *argv[])
ret
=
restore
(
c
);
ret
=
restore
(
c
);
else
else
ret
=
checkpoint
(
c
);
ret
=
checkpoint
(
c
);
free
(
actionscript_path
);
free
(
checkpoint_dir
);
free
(
predump_dir
);
if
(
!
ret
)
if
(
!
ret
)
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
...
...
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