Commit 23befb18 by Tycho Andersen Committed by Stéphane Graber

c/r: teach criu about cgmanager's socket

CRIU needs to be told when something is bind mounted into the container from the outside as cgmanager's socket is. Signed-off-by: 's avatarTycho Andersen <tycho.andersen@canonical.com> Acked-by: 's avatarSerge E. Hallyn <serge.hallyn@ubuntu.com>
parent ea7e3744
......@@ -2403,4 +2403,5 @@ static struct cgroup_ops cgfs_ops = {
.chown = NULL,
.mount_cgroup = cgroupfs_mount_cgroup,
.nrtasks = cgfs_nrtasks,
.driver = CGFS,
};
......@@ -1397,5 +1397,6 @@ static struct cgroup_ops cgmanager_ops = {
.mount_cgroup = cgm_mount_cgroup,
.nrtasks = cgm_get_nrtasks,
.disconnect = NULL,
.driver = CGMANAGER,
};
#endif
......@@ -189,3 +189,8 @@ void cgroup_disconnect(void)
if (ops && ops->disconnect)
ops->disconnect();
}
cgroup_driver_t cgroup_driver(void)
{
return ops->driver;
}
......@@ -32,6 +32,11 @@ struct lxc_handler;
struct lxc_conf;
struct lxc_list;
typedef enum {
CGFS,
CGMANAGER,
} cgroup_driver_t;
struct cgroup_ops {
const char *name;
......@@ -51,6 +56,7 @@ struct cgroup_ops {
bool (*mount_cgroup)(void *hdata, const char *root, int type);
int (*nrtasks)(void *hdata);
void (*disconnect)(void);
cgroup_driver_t driver;
};
extern bool cgroup_attach(const char *name, const char *lxcpath, pid_t pid);
......@@ -72,5 +78,6 @@ extern const char *cgroup_get_cgroup(struct lxc_handler *handler, const char *su
extern const char *cgroup_canonical_path(struct lxc_handler *handler);
extern bool cgroup_unfreeze(struct lxc_handler *handler);
extern void cgroup_disconnect(void);
extern cgroup_driver_t cgroup_driver(void);
#endif
......@@ -3736,6 +3736,11 @@ static void exec_criu(struct criu_opts *opts)
return;
}
// We need to tell criu where cgmanager's socket is bind mounted from
// if it exists since it's external.
if (cgroup_driver() == CGMANAGER)
static_args+=2;
argv = malloc(static_args * sizeof(*argv));
if (!argv)
return;
......@@ -3778,6 +3783,11 @@ static void exec_criu(struct criu_opts *opts)
if (strcmp(opts->action, "dump") == 0) {
char pid[32];
if (cgroup_driver() == CGMANAGER) {
DECLARE_ARG("--ext-mount-map");
DECLARE_ARG("/sys/fs/cgroup/cgmanager:cgmanager");
}
if (sprintf(pid, "%d", lxcapi_init_pid(opts->c)) < 0)
goto err;
......@@ -3786,6 +3796,12 @@ static void exec_criu(struct criu_opts *opts)
if (!opts->stop)
DECLARE_ARG("--leave-running");
} else if (strcmp(opts->action, "restore") == 0) {
if (cgroup_driver() == CGMANAGER) {
DECLARE_ARG("--ext-mount-map");
DECLARE_ARG("cgmanager:/sys/fs/cgroup/cgmanager");
}
DECLARE_ARG("--root");
DECLARE_ARG(opts->c->lxc_conf->rootfs.mount);
DECLARE_ARG("--restore-detached");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment