Commit c6c37c20 by Tycho Andersen Committed by Stéphane Graber

c/r: add an option to use faster inotify support in CRIU

The idea here is that criu can use open_by_handle on a configuration which will preserve inodes on moves across hosts, but shouldn't do that on configurations which won't preserve inodes. Before, we forced it to always be slow, but we don't have to do this. Signed-off-by: 's avatarTycho Andersen <tycho.andersen@canonical.com>
parent 9d928ec5
...@@ -115,7 +115,7 @@ static int load_tty_major_minor(char *directory, char *output, int len) ...@@ -115,7 +115,7 @@ static int load_tty_major_minor(char *directory, char *output, int len)
static void exec_criu(struct criu_opts *opts) static void exec_criu(struct criu_opts *opts)
{ {
char **argv, log[PATH_MAX]; char **argv, log[PATH_MAX];
int static_args = 24, argc = 0, i, ret; int static_args = 23, argc = 0, i, ret;
int netnr = 0; int netnr = 0;
struct lxc_list *it; struct lxc_list *it;
...@@ -134,7 +134,7 @@ static void exec_criu(struct criu_opts *opts) ...@@ -134,7 +134,7 @@ static void exec_criu(struct criu_opts *opts)
} }
/* The command line always looks like: /* The command line always looks like:
* criu $(action) --tcp-established --file-locks --link-remap --force-irmap \ * criu $(action) --tcp-established --file-locks --link-remap \
* --manage-cgroups action-script foo.sh -D $(directory) \ * --manage-cgroups action-script foo.sh -D $(directory) \
* -o $(directory)/$(action).log --ext-mount-map auto * -o $(directory)/$(action).log --ext-mount-map auto
* --enable-external-sharing --enable-external-masters * --enable-external-sharing --enable-external-masters
...@@ -160,6 +160,10 @@ static void exec_criu(struct criu_opts *opts) ...@@ -160,6 +160,10 @@ static void exec_criu(struct criu_opts *opts)
/* --external tty[88,4] */ /* --external tty[88,4] */
if (opts->tty_id[0]) if (opts->tty_id[0])
static_args += 2; static_args += 2;
/* --force-irmap */
if (!opts->user->preserves_inodes)
static_args++;
} else if (strcmp(opts->action, "restore") == 0) { } else if (strcmp(opts->action, "restore") == 0) {
/* --root $(lxc_mount_point) --restore-detached /* --root $(lxc_mount_point) --restore-detached
* --restore-sibling --pidfile $foo --cgroup-root $foo * --restore-sibling --pidfile $foo --cgroup-root $foo
...@@ -214,7 +218,6 @@ static void exec_criu(struct criu_opts *opts) ...@@ -214,7 +218,6 @@ static void exec_criu(struct criu_opts *opts)
DECLARE_ARG("--tcp-established"); DECLARE_ARG("--tcp-established");
DECLARE_ARG("--file-locks"); DECLARE_ARG("--file-locks");
DECLARE_ARG("--link-remap"); DECLARE_ARG("--link-remap");
DECLARE_ARG("--force-irmap");
DECLARE_ARG("--manage-cgroups"); DECLARE_ARG("--manage-cgroups");
DECLARE_ARG("--ext-mount-map"); DECLARE_ARG("--ext-mount-map");
DECLARE_ARG("auto"); DECLARE_ARG("auto");
...@@ -277,6 +280,9 @@ static void exec_criu(struct criu_opts *opts) ...@@ -277,6 +280,9 @@ static void exec_criu(struct criu_opts *opts)
DECLARE_ARG(opts->user->pageserver_port); DECLARE_ARG(opts->user->pageserver_port);
} }
if (!opts->user->preserves_inodes)
DECLARE_ARG("--force-irmap");
/* only for final dump */ /* only for final dump */
if (strcmp(opts->action, "dump") == 0 && !opts->user->stop) if (strcmp(opts->action, "dump") == 0 && !opts->user->stop)
DECLARE_ARG("--leave-running"); DECLARE_ARG("--leave-running");
......
...@@ -884,6 +884,13 @@ struct migrate_opts { ...@@ -884,6 +884,13 @@ struct migrate_opts {
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_address; /* where should memory pages be send? */
char *pageserver_port; char *pageserver_port;
/* This flag indicates whether or not the container's rootfs will have
* the same inodes on checkpoint and restore. In the case of e.g. zfs
* send or btrfs send, or an LVM snapshot, this will be true, but it
* won't if e.g. you rsync the filesystems between two machines.
*/
bool preserves_inodes;
}; };
/*! /*!
......
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