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
442ad5c6
Commit
442ad5c6
authored
Mar 31, 2016
by
Stéphane Graber
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #931 from n-eiling/pageserver-support
c/r: support for the criu pageserver
parents
5f1728f1
74eb576c
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
9 deletions
+30
-9
criu.c
src/lxc/criu.c
+24
-5
criu.h
src/lxc/criu.h
+2
-2
lxccontainer.c
src/lxc/lxccontainer.c
+2
-2
lxccontainer.h
src/lxc/lxccontainer.h
+2
-0
No files found.
src/lxc/criu.c
View file @
442ad5c6
...
@@ -82,6 +82,10 @@ struct criu_opts {
...
@@ -82,6 +82,10 @@ struct criu_opts {
* different) on the target host. NULL if lxc.console = "none".
* different) on the target host. NULL if lxc.console = "none".
*/
*/
char
*
console_name
;
char
*
console_name
;
/* Address and port where a criu pageserver is listening */
char
*
pageserver_address
;
char
*
pageserver_port
;
};
};
static
int
load_tty_major_minor
(
char
*
directory
,
char
*
output
,
int
len
)
static
int
load_tty_major_minor
(
char
*
directory
,
char
*
output
,
int
len
)
...
@@ -156,6 +160,10 @@ static void exec_criu(struct criu_opts *opts)
...
@@ -156,6 +160,10 @@ static void exec_criu(struct criu_opts *opts)
if
(
opts
->
predump_dir
)
if
(
opts
->
predump_dir
)
static_args
+=
2
;
static_args
+=
2
;
/* --page-server --address <address> --port <port> */
if
(
opts
->
pageserver_address
&&
opts
->
pageserver_port
)
static_args
+=
5
;
/* --leave-running (only for final dump) */
/* --leave-running (only for final dump) */
if
(
strcmp
(
opts
->
action
,
"dump"
)
==
0
&&
!
opts
->
stop
)
if
(
strcmp
(
opts
->
action
,
"dump"
)
==
0
&&
!
opts
->
stop
)
static_args
++
;
static_args
++
;
...
@@ -272,6 +280,14 @@ static void exec_criu(struct criu_opts *opts)
...
@@ -272,6 +280,14 @@ static void exec_criu(struct criu_opts *opts)
DECLARE_ARG
(
opts
->
predump_dir
);
DECLARE_ARG
(
opts
->
predump_dir
);
}
}
if
(
opts
->
pageserver_address
&&
opts
->
pageserver_port
)
{
DECLARE_ARG
(
"--page-server"
);
DECLARE_ARG
(
"--address"
);
DECLARE_ARG
(
opts
->
pageserver_address
);
DECLARE_ARG
(
"--port"
);
DECLARE_ARG
(
opts
->
pageserver_port
);
}
/* only for final dump */
/* only for final dump */
if
(
strcmp
(
opts
->
action
,
"dump"
)
==
0
&&
!
opts
->
stop
)
if
(
strcmp
(
opts
->
action
,
"dump"
)
==
0
&&
!
opts
->
stop
)
DECLARE_ARG
(
"--leave-running"
);
DECLARE_ARG
(
"--leave-running"
);
...
@@ -814,7 +830,8 @@ static int save_tty_major_minor(char *directory, struct lxc_container *c, char *
...
@@ -814,7 +830,8 @@ static int save_tty_major_minor(char *directory, struct lxc_container *c, char *
/* do one of either predump or a regular dump */
/* do one of either predump or a regular dump */
static
bool
do_dump
(
struct
lxc_container
*
c
,
char
*
mode
,
char
*
directory
,
static
bool
do_dump
(
struct
lxc_container
*
c
,
char
*
mode
,
char
*
directory
,
bool
stop
,
bool
verbose
,
char
*
predump_dir
)
bool
stop
,
bool
verbose
,
char
*
predump_dir
,
char
*
pageserver_address
,
char
*
pageserver_port
)
{
{
pid_t
pid
;
pid_t
pid
;
...
@@ -840,6 +857,8 @@ static bool do_dump(struct lxc_container *c, char *mode, char *directory,
...
@@ -840,6 +857,8 @@ static bool do_dump(struct lxc_container *c, char *mode, char *directory,
os
.
verbose
=
verbose
;
os
.
verbose
=
verbose
;
os
.
predump_dir
=
predump_dir
;
os
.
predump_dir
=
predump_dir
;
os
.
console_name
=
c
->
lxc_conf
->
console
.
path
;
os
.
console_name
=
c
->
lxc_conf
->
console
.
path
;
os
.
pageserver_address
=
pageserver_address
;
os
.
pageserver_port
=
pageserver_port
;
if
(
save_tty_major_minor
(
directory
,
c
,
os
.
tty_id
,
sizeof
(
os
.
tty_id
))
<
0
)
if
(
save_tty_major_minor
(
directory
,
c
,
os
.
tty_id
,
sizeof
(
os
.
tty_id
))
<
0
)
exit
(
1
);
exit
(
1
);
...
@@ -872,12 +891,12 @@ static bool do_dump(struct lxc_container *c, char *mode, char *directory,
...
@@ -872,12 +891,12 @@ static bool do_dump(struct lxc_container *c, char *mode, char *directory,
}
}
}
}
bool
__criu_pre_dump
(
struct
lxc_container
*
c
,
char
*
directory
,
bool
verbose
,
char
*
predump_dir
)
bool
__criu_pre_dump
(
struct
lxc_container
*
c
,
char
*
directory
,
bool
verbose
,
char
*
predump_dir
,
char
*
pageserver_address
,
char
*
pageserver_port
)
{
{
return
do_dump
(
c
,
"pre-dump"
,
directory
,
false
,
verbose
,
predump_dir
);
return
do_dump
(
c
,
"pre-dump"
,
directory
,
false
,
verbose
,
predump_dir
,
pageserver_address
,
pageserver_port
);
}
}
bool
__criu_dump
(
struct
lxc_container
*
c
,
char
*
directory
,
bool
stop
,
bool
verbose
,
char
*
predump_dir
)
bool
__criu_dump
(
struct
lxc_container
*
c
,
char
*
directory
,
bool
stop
,
bool
verbose
,
char
*
predump_dir
,
char
*
pageserver_address
,
char
*
pageserver_port
)
{
{
char
path
[
PATH_MAX
];
char
path
[
PATH_MAX
];
int
ret
;
int
ret
;
...
@@ -891,7 +910,7 @@ bool __criu_dump(struct lxc_container *c, char *directory, bool stop, bool verbo
...
@@ -891,7 +910,7 @@ bool __criu_dump(struct lxc_container *c, char *directory, bool stop, bool verbo
return
false
;
return
false
;
}
}
return
do_dump
(
c
,
"dump"
,
directory
,
stop
,
verbose
,
predump_dir
);
return
do_dump
(
c
,
"dump"
,
directory
,
stop
,
verbose
,
predump_dir
,
pageserver_address
,
pageserver_port
);
}
}
bool
__criu_restore
(
struct
lxc_container
*
c
,
char
*
directory
,
bool
verbose
)
bool
__criu_restore
(
struct
lxc_container
*
c
,
char
*
directory
,
bool
verbose
)
...
...
src/lxc/criu.h
View file @
442ad5c6
...
@@ -27,8 +27,8 @@
...
@@ -27,8 +27,8 @@
#include <lxc/lxccontainer.h>
#include <lxc/lxccontainer.h>
bool
__criu_pre_dump
(
struct
lxc_container
*
c
,
char
*
directory
,
bool
verbose
,
char
*
predump_dir
);
bool
__criu_pre_dump
(
struct
lxc_container
*
c
,
char
*
directory
,
bool
verbose
,
char
*
predump_dir
,
char
*
pageserver_address
,
char
*
pageserver_port
);
bool
__criu_dump
(
struct
lxc_container
*
c
,
char
*
directory
,
bool
stop
,
bool
verbose
,
char
*
predump_dir
);
bool
__criu_dump
(
struct
lxc_container
*
c
,
char
*
directory
,
bool
stop
,
bool
verbose
,
char
*
predump_dir
,
char
*
pageserver_address
,
char
*
pageserver_port
);
bool
__criu_restore
(
struct
lxc_container
*
c
,
char
*
directory
,
bool
verbose
);
bool
__criu_restore
(
struct
lxc_container
*
c
,
char
*
directory
,
bool
verbose
);
#endif
#endif
src/lxc/lxccontainer.c
View file @
442ad5c6
...
@@ -3955,10 +3955,10 @@ static int do_lxcapi_migrate(struct lxc_container *c, unsigned int cmd,
...
@@ -3955,10 +3955,10 @@ static int do_lxcapi_migrate(struct lxc_container *c, unsigned int cmd,
switch
(
cmd
)
{
switch
(
cmd
)
{
case
MIGRATE_PRE_DUMP
:
case
MIGRATE_PRE_DUMP
:
ret
=
!
__criu_pre_dump
(
c
,
opts
->
directory
,
opts
->
verbose
,
opts
->
predump_dir
);
ret
=
!
__criu_pre_dump
(
c
,
opts
->
directory
,
opts
->
verbose
,
opts
->
predump_dir
,
opts
->
pageserver_address
,
opts
->
pageserver_port
);
break
;
break
;
case
MIGRATE_DUMP
:
case
MIGRATE_DUMP
:
ret
=
!
__criu_dump
(
c
,
opts
->
directory
,
opts
->
stop
,
opts
->
verbose
,
opts
->
predump_dir
);
ret
=
!
__criu_dump
(
c
,
opts
->
directory
,
opts
->
stop
,
opts
->
verbose
,
opts
->
predump_dir
,
opts
->
pageserver_address
,
opts
->
pageserver_port
);
break
;
break
;
case
MIGRATE_RESTORE
:
case
MIGRATE_RESTORE
:
ret
=
!
__criu_restore
(
c
,
opts
->
directory
,
opts
->
verbose
);
ret
=
!
__criu_restore
(
c
,
opts
->
directory
,
opts
->
verbose
);
...
...
src/lxc/lxccontainer.h
View file @
442ad5c6
...
@@ -882,6 +882,8 @@ struct migrate_opts {
...
@@ -882,6 +882,8 @@ struct migrate_opts {
bool
stop
;
/* stop the container after dump? */
bool
stop
;
/* stop the container after dump? */
char
*
predump_dir
;
/* relative to directory above */
char
*
predump_dir
;
/* relative to directory above */
char
*
pageserver_address
;
/* where should memory pages be send? */
char
*
pageserver_port
;
};
};
/*!
/*!
...
...
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