storage: handle overlay for stable 2.0

parent 2cda3803
...@@ -368,11 +368,8 @@ struct bdev *bdev_copy(struct lxc_container *c0, const char *cname, ...@@ -368,11 +368,8 @@ struct bdev *bdev_copy(struct lxc_container *c0, const char *cname,
if (maybe_snap && keepbdevtype && !bdevtype && !orig->ops->can_snapshot) if (maybe_snap && keepbdevtype && !bdevtype && !orig->ops->can_snapshot)
snap = false; snap = false;
/* /* If newtype is NULL and snapshot is set, then use overlayfs. */
* If newtype is NULL and snapshot is set, then use overlayfs if (!bdevtype && !keepbdevtype && snap && (!strcmp(orig->type, "dir") || !strcmp(orig->type, "overlayfs")))
*/
if (!bdevtype && !keepbdevtype && snap &&
strcmp(orig->type, "dir") == 0)
bdevtype = "overlayfs"; bdevtype = "overlayfs";
if (am_unpriv() && !unpriv_snap_allowed(orig, bdevtype, snap, maybe_snap)) { if (am_unpriv() && !unpriv_snap_allowed(orig, bdevtype, snap, maybe_snap)) {
...@@ -391,10 +388,11 @@ struct bdev *bdev_copy(struct lxc_container *c0, const char *cname, ...@@ -391,10 +388,11 @@ struct bdev *bdev_copy(struct lxc_container *c0, const char *cname,
*needs_rdep = 1; *needs_rdep = 1;
} }
if (strcmp(oldpath, lxcpath) && !bdevtype) if (strcmp(oldpath, lxcpath) && !bdevtype && strcmp(orig->type, "overlayfs"))
bdevtype = "dir"; bdevtype = "dir";
else if (!bdevtype) else if (!bdevtype)
bdevtype = orig->type; bdevtype = orig->type;
new = bdev_get(bdevtype); new = bdev_get(bdevtype);
if (!new) { if (!new) {
ERROR("no such block device type: %s", ERROR("no such block device type: %s",
......
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