]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
storage: default to orig type on identical paths
authorChristian Brauner <christian.brauner@ubuntu.com>
Sat, 15 Jul 2017 13:32:52 +0000 (15:32 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Mon, 31 Jul 2017 21:34:11 +0000 (23:34 +0200)
otherwise default to "dir"

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/bdev/bdev.c

index 1bc8afcd04c55800f71e12bc864a293017395ebe..bef79f70f4e628ec77fc9d8105751edc956ab0f8 100644 (file)
@@ -270,6 +270,9 @@ static struct bdev *do_bdev_create(const char *dest, const char *type,
 
        struct bdev *bdev;
 
+       if (!type)
+               type = "dir";
+
        bdev = bdev_get(type);
        if (!bdev)
                return NULL;
@@ -389,7 +392,11 @@ struct bdev *bdev_copy(struct lxc_container *c0, const char *cname,
                *needs_rdep = 1;
        }
 
-       new = bdev_get(bdevtype ? bdevtype : orig->type);
+       if (strcmp(oldpath, lxcpath) && !bdevtype)
+               bdevtype = "dir";
+       else if (!bdevtype)
+               bdevtype = orig->type;
+       new = bdev_get(bdevtype);
        if (!new) {
                ERROR("no such block device type: %s",
                      bdevtype ? bdevtype : orig->type);