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
a8bae552
Commit
a8bae552
authored
Nov 15, 2016
by
Stéphane Graber
Committed by
GitHub
Nov 15, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1299 from adrianreber/master
lxc-checkpoint: enable dirty memory tracking in criu
parents
748c52b5
9f99a33f
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
2 deletions
+42
-2
criu.c
src/lxc/criu.c
+1
-0
lxc_checkpoint.c
src/lxc/tools/lxc_checkpoint.c
+41
-2
No files found.
src/lxc/criu.c
View file @
a8bae552
...
@@ -398,6 +398,7 @@ static void exec_criu(struct criu_opts *opts)
...
@@ -398,6 +398,7 @@ static void exec_criu(struct criu_opts *opts)
if
(
opts
->
user
->
predump_dir
)
{
if
(
opts
->
user
->
predump_dir
)
{
DECLARE_ARG
(
"--prev-images-dir"
);
DECLARE_ARG
(
"--prev-images-dir"
);
DECLARE_ARG
(
opts
->
user
->
predump_dir
);
DECLARE_ARG
(
opts
->
user
->
predump_dir
);
DECLARE_ARG
(
"--track-mem"
);
}
}
if
(
opts
->
user
->
pageserver_address
&&
opts
->
user
->
pageserver_port
)
{
if
(
opts
->
user
->
pageserver_address
&&
opts
->
user
->
pageserver_port
)
{
...
...
src/lxc/tools/lxc_checkpoint.c
View file @
a8bae552
...
@@ -36,6 +36,10 @@ static bool stop = false;
...
@@ -36,6 +36,10 @@ static bool stop = false;
static
bool
verbose
=
false
;
static
bool
verbose
=
false
;
static
bool
do_restore
=
false
;
static
bool
do_restore
=
false
;
static
bool
daemonize_set
=
false
;
static
bool
daemonize_set
=
false
;
static
bool
pre_dump
=
false
;
static
char
*
predump_dir
=
NULL
;
#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'
},
...
@@ -44,6 +48,8 @@ static const struct option my_longopts[] = {
...
@@ -44,6 +48,8 @@ static const struct option my_longopts[] = {
{
"restore"
,
no_argument
,
0
,
'r'
},
{
"restore"
,
no_argument
,
0
,
'r'
},
{
"daemon"
,
no_argument
,
0
,
'd'
},
{
"daemon"
,
no_argument
,
0
,
'd'
},
{
"foreground"
,
no_argument
,
0
,
'F'
},
{
"foreground"
,
no_argument
,
0
,
'F'
},
{
"pre-dump"
,
no_argument
,
0
,
'p'
},
{
"predump-dir"
,
required_argument
,
0
,
OPT_PREDUMP_DIR
},
LXC_COMMON_OPTIONS
LXC_COMMON_OPTIONS
};
};
...
@@ -63,6 +69,11 @@ static int my_checker(const struct lxc_arguments *args)
...
@@ -63,6 +69,11 @@ static int my_checker(const struct lxc_arguments *args)
return
-
1
;
return
-
1
;
}
}
if
(
pre_dump
&&
do_restore
)
{
lxc_error
(
args
,
"-p not compatible with -r."
);
return
-
1
;
}
return
0
;
return
0
;
}
}
...
@@ -91,6 +102,14 @@ static int my_parser(struct lxc_arguments *args, int c, char *arg)
...
@@ -91,6 +102,14 @@ static int my_parser(struct lxc_arguments *args, int c, char *arg)
args
->
daemonize
=
0
;
args
->
daemonize
=
0
;
daemonize_set
=
true
;
daemonize_set
=
true
;
break
;
break
;
case
'p'
:
pre_dump
=
true
;
break
;
case
OPT_PREDUMP_DIR
:
predump_dir
=
strdup
(
arg
);
if
(
!
predump_dir
)
return
-
1
;
break
;
}
}
return
0
;
return
0
;
}
}
...
@@ -111,6 +130,10 @@ Options :\n\
...
@@ -111,6 +130,10 @@ Options :\n\
-v, --verbose Enable verbose criu logs
\n
\
-v, --verbose Enable verbose criu logs
\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
\
Container keeps on running and following
\n
\
checkpoints will only dump the changes.
\n
\
--predump-dir=DIR path to images from previous dump (relative to -D)
\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
\
...
@@ -124,7 +147,9 @@ Options :\n\
...
@@ -124,7 +147,9 @@ Options :\n\
static
bool
checkpoint
(
struct
lxc_container
*
c
)
static
bool
checkpoint
(
struct
lxc_container
*
c
)
{
{
struct
migrate_opts
opts
;
bool
ret
;
bool
ret
;
int
mode
;
if
(
!
c
->
is_running
(
c
))
{
if
(
!
c
->
is_running
(
c
))
{
fprintf
(
stderr
,
"%s not running, not checkpointing.
\n
"
,
my_args
.
name
);
fprintf
(
stderr
,
"%s not running, not checkpointing.
\n
"
,
my_args
.
name
);
...
@@ -132,10 +157,24 @@ static bool checkpoint(struct lxc_container *c)
...
@@ -132,10 +157,24 @@ static bool checkpoint(struct lxc_container *c)
return
false
;
return
false
;
}
}
ret
=
c
->
checkpoint
(
c
,
checkpoint_dir
,
stop
,
verbose
);
memset
(
&
opts
,
0
,
sizeof
(
opts
));
opts
.
directory
=
checkpoint_dir
;
opts
.
stop
=
stop
;
opts
.
verbose
=
verbose
;
opts
.
predump_dir
=
predump_dir
;
if
(
pre_dump
)
mode
=
MIGRATE_PRE_DUMP
;
else
mode
=
MIGRATE_DUMP
;
ret
=
c
->
migrate
(
c
,
mode
,
&
opts
,
sizeof
(
opts
));
lxc_container_put
(
c
);
lxc_container_put
(
c
);
if
(
!
ret
)
{
/* the migrate() API does not negate the return code like
* checkpoint() and restore() does. */
if
(
ret
)
{
fprintf
(
stderr
,
"Checkpointing %s failed.
\n
"
,
my_args
.
name
);
fprintf
(
stderr
,
"Checkpointing %s failed.
\n
"
,
my_args
.
name
);
return
false
;
return
false
;
}
}
...
...
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