From e3fdf5cc9c60eb97f8520f059ad1a09d3f73509d Mon Sep 17 00:00:00 2001 From: Serge Hallyn Date: Fri, 16 Aug 2013 15:50:25 -0500 Subject: [PATCH] lxc-clone: default to overlaysf for -s clone of dir 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 --- src/lxc/bdev.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/lxc/bdev.c b/src/lxc/bdev.c index c96ccfe50..60d929033 100644 --- a/src/lxc/bdev.c +++ b/src/lxc/bdev.c @@ -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);