]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
c/r: add an option to use faster inotify support in CRIU 1019/head
authorTycho Andersen <tycho.andersen@canonical.com>
Wed, 11 May 2016 13:51:11 +0000 (07:51 -0600)
committerTycho Andersen <tycho.andersen@canonical.com>
Wed, 11 May 2016 13:59:48 +0000 (13:59 +0000)
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: Tycho Andersen <tycho.andersen@canonical.com>
src/lxc/criu.c
src/lxc/lxccontainer.h

index 18cca3c0ecf1f02e23ee0bb3a3cfa81d35cf8e8e..ce8ada6f1bfbd66569751dd5d8672e9f5054ffe9 100644 (file)
@@ -115,7 +115,7 @@ static int load_tty_major_minor(char *directory, char *output, int len)
 static void exec_criu(struct criu_opts *opts)
 {
        char **argv, log[PATH_MAX];
-       int static_args = 24, argc = 0, i, ret;
+       int static_args = 23, argc = 0, i, ret;
        int netnr = 0;
        struct lxc_list *it;
 
@@ -134,7 +134,7 @@ static void exec_criu(struct criu_opts *opts)
        }
 
        /* 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) \
         * -o $(directory)/$(action).log --ext-mount-map auto
         * --enable-external-sharing --enable-external-masters
@@ -160,6 +160,10 @@ static void exec_criu(struct criu_opts *opts)
                /* --external tty[88,4] */
                if (opts->tty_id[0])
                        static_args += 2;
+
+               /* --force-irmap */
+               if (!opts->user->preserves_inodes)
+                       static_args++;
        } else if (strcmp(opts->action, "restore") == 0) {
                /* --root $(lxc_mount_point) --restore-detached
                 * --restore-sibling --pidfile $foo --cgroup-root $foo
@@ -214,7 +218,6 @@ static void exec_criu(struct criu_opts *opts)
        DECLARE_ARG("--tcp-established");
        DECLARE_ARG("--file-locks");
        DECLARE_ARG("--link-remap");
-       DECLARE_ARG("--force-irmap");
        DECLARE_ARG("--manage-cgroups");
        DECLARE_ARG("--ext-mount-map");
        DECLARE_ARG("auto");
@@ -277,6 +280,9 @@ static void exec_criu(struct criu_opts *opts)
                        DECLARE_ARG(opts->user->pageserver_port);
                }
 
+               if (!opts->user->preserves_inodes)
+                       DECLARE_ARG("--force-irmap");
+
                /* only for final dump */
                if (strcmp(opts->action, "dump") == 0 && !opts->user->stop)
                        DECLARE_ARG("--leave-running");
index 0e014bc800e031582b1b11488dac6f5ec5126225..ecc66e226052868dd9caafd3287f7aa70dfc3f6b 100644 (file)
@@ -884,6 +884,13 @@ struct migrate_opts {
        char *predump_dir; /* relative to directory above */
        char *pageserver_address; /* where should memory pages be send? */
        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;
 };
 
 /*!