.destroy = &dir_destroy,
.create = &dir_create,
.can_snapshot = false,
+ .can_backup = true,
};
.destroy = &zfs_destroy,
.create = &zfs_create,
.can_snapshot = true,
+ .can_backup = true,
};
//
.destroy = &lvm_destroy,
.create = &lvm_create,
.can_snapshot = true,
+ .can_backup = false,
};
/*
.destroy = &btrfs_destroy,
.create = &btrfs_create,
.can_snapshot = true,
+ .can_backup = true,
};
//
.destroy = &loop_destroy,
.create = &loop_create,
.can_snapshot = false,
+ .can_backup = true,
};
//
.destroy = &overlayfs_destroy,
.create = &overlayfs_create,
.can_snapshot = true,
+ .can_backup = true,
};
//
.destroy = &aufs_destroy,
.create = &aufs_create,
.can_snapshot = true,
+ .can_backup = true,
};
//
.destroy = &nbd_destroy,
.create = &nbd_create,
.can_snapshot = true,
+ .can_backup = false,
};
static const struct bdev_type bdevs[] = {
struct bdev *bdev;
const struct bdev_type *q;
+ if (!src)
+ src = conf->rootfs.path;
+
+ if (!src)
+ return NULL;
+
q = bdev_query(src);
if (!q)
return NULL;
return ret;
}
+bool bdev_can_backup(struct lxc_conf *conf)
+{
+ struct bdev *bdev = bdev_init(conf, NULL, NULL, NULL);
+ bool ret;
+
+ if (!bdev)
+ return false;
+ ret = bdev->ops->can_backup;
+ bdev_put(bdev);
+ return ret;
+}
+
/*
* is an unprivileged user allowed to make this kind of snapshot
*/
const char *cname, const char *oldpath, const char *lxcpath,
int snap, uint64_t newsize, struct lxc_conf *conf);
bool can_snapshot;
+ bool can_backup;
};
/*
char *overlay_getlower(char *p);
bool bdev_is_dir(struct lxc_conf *conf, const char *path);
+bool bdev_can_backup(struct lxc_conf *conf);
/*
* Instantiate a bdev object. The src is used to determine which blockdev
if (!c || !lxcapi_is_defined(c))
return -1;
+ if (!bdev_can_backup(c->lxc_conf)) {
+ ERROR("%s's backing store cannot be backed up.", c->name);
+ ERROR("Your container must use another backing store type.");
+ return -1;
+ }
+
if (!get_snappath_dir(c, snappath))
return -1;