]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
lxc-clone: default to overlaysf for -s clone of dir
authorSerge Hallyn <serge.hallyn@ubuntu.com>
Fri, 16 Aug 2013 20:50:25 +0000 (15:50 -0500)
committerSerge Hallyn <serge.hallyn@ubuntu.com>
Fri, 16 Aug 2013 20:50:25 +0000 (15:50 -0500)
If you go to the trouble to request a -s (snapshot) clone of
a container which is dir backingstore, then you deserve an
overlayfs clone.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
src/lxc/bdev.c

index c96ccfe50db0aed6d35e235caff80f01a0fd0fbe..60d929033420f0222b76e97547b197e46a06d303 100644 (file)
@@ -1922,6 +1922,12 @@ struct bdev *bdev_copy(const char *src, const char *oldname, const char *cname,
                }
        }
 
+       /*
+        * If newtype is NULL and snapshot is set, then use overlayfs
+        */
+       if (!bdevtype && snap && strcmp(orig->type , "dir") == 0)
+               bdevtype = "overlayfs";
+
        new = bdev_get(bdevtype ? bdevtype : orig->type);
        if (!new) {
                ERROR("no such block device type: %s", bdevtype ? bdevtype : orig->type);