From: Christian Brauner Date: Sun, 16 Jul 2017 22:01:46 +0000 (+0200) Subject: storage: add create_{clone,snapshot}() X-Git-Tag: lxc-2.1.0~32^2~26 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=805d9bf49c9f783146455c10f618d20aba9af795;p=thirdparty%2Flxc.git storage: add create_{clone,snapshot}() Signed-off-by: Christian Brauner --- diff --git a/src/lxc/bdev/bdev.c b/src/lxc/bdev/bdev.c index d31957223..5ae3ba657 100644 --- a/src/lxc/bdev/bdev.c +++ b/src/lxc/bdev/bdev.c @@ -82,6 +82,8 @@ static const struct bdev_ops aufs_ops = { .clone_paths = &aufs_clonepaths, .destroy = &aufs_destroy, .create = &aufs_create, + .create_clone = NULL, + .create_snapshot = NULL, .can_snapshot = true, .can_backup = true, }; @@ -94,6 +96,8 @@ static const struct bdev_ops btrfs_ops = { .clone_paths = &btrfs_clonepaths, .destroy = &btrfs_destroy, .create = &btrfs_create, + .create_clone = NULL, + .create_snapshot = NULL, .can_snapshot = true, .can_backup = true, }; @@ -106,6 +110,8 @@ static const struct bdev_ops dir_ops = { .clone_paths = &dir_clonepaths, .destroy = &dir_destroy, .create = &dir_create, + .create_clone = NULL, + .create_snapshot = NULL, .can_snapshot = false, .can_backup = true, }; @@ -118,6 +124,8 @@ static const struct bdev_ops loop_ops = { .clone_paths = &loop_clonepaths, .destroy = &loop_destroy, .create = &loop_create, + .create_clone = NULL, + .create_snapshot = NULL, .can_snapshot = false, .can_backup = true, }; @@ -130,6 +138,8 @@ static const struct bdev_ops lvm_ops = { .clone_paths = &lvm_clonepaths, .destroy = &lvm_destroy, .create = &lvm_create, + .create_clone = NULL, + .create_snapshot = NULL, .can_snapshot = true, .can_backup = false, }; @@ -142,6 +152,8 @@ const struct bdev_ops nbd_ops = { .clone_paths = &nbd_clonepaths, .destroy = &nbd_destroy, .create = &nbd_create, + .create_clone = NULL, + .create_snapshot = NULL, .can_snapshot = true, .can_backup = false, }; @@ -154,6 +166,8 @@ static const struct bdev_ops ovl_ops = { .clone_paths = &ovl_clonepaths, .destroy = &ovl_destroy, .create = &ovl_create, + .create_clone = NULL, + .create_snapshot = NULL, .can_snapshot = true, .can_backup = true, }; @@ -166,6 +180,8 @@ static const struct bdev_ops rbd_ops = { .clone_paths = &rbd_clonepaths, .destroy = &rbd_destroy, .create = &rbd_create, + .create_clone = NULL, + .create_snapshot = NULL, .can_snapshot = false, .can_backup = false, }; @@ -178,6 +194,8 @@ static const struct bdev_ops zfs_ops = { .clone_paths = &zfs_clonepaths, .destroy = &zfs_destroy, .create = &zfs_create, + .create_clone = NULL, + .create_snapshot = NULL, .can_snapshot = true, .can_backup = true, }; diff --git a/src/lxc/bdev/bdev.h b/src/lxc/bdev/bdev.h index 22133173a..5a14e3376 100644 --- a/src/lxc/bdev/bdev.h +++ b/src/lxc/bdev/bdev.h @@ -73,6 +73,10 @@ struct bdev_ops { const char *oldname, const char *cname, const char *oldpath, const char *lxcpath, int snap, uint64_t newsize, struct lxc_conf *conf); + bool (*create_clone)(struct lxc_conf *conf, struct bdev *orig, + struct bdev *new, uint64_t newsize); + bool (*create_snapshot)(struct lxc_conf *conf, struct bdev *orig, + struct bdev *new); bool can_snapshot; bool can_backup; };