diff options
author | Douglas Fuller <dfuller@redhat.com> | 2016-05-09 20:21:21 +0200 |
---|---|---|
committer | Douglas Fuller <dfuller@redhat.com> | 2016-06-07 22:44:24 +0200 |
commit | 653bc453e3c8f1062cdbc4d0d8f77f623f48915b (patch) | |
tree | 6e86df8727ef314a0bfc5dee1d1c93ccba169fcd /src/test/pybind | |
parent | Merge pull request #8298 from wjwithagen/wip-wjw-freebsd-autobuild-2 (diff) | |
download | ceph-653bc453e3c8f1062cdbc4d0d8f77f623f48915b.tar.xz ceph-653bc453e3c8f1062cdbc4d0d8f77f623f48915b.zip |
rbd: add methods to set and get snapshot limits
Add a subcommand, rbd snap limit set <image> --limit <integer>, to
limit the number of snapshots that may be made of a given image.
To clear, use rbd snap limit clear <image>. Add an omap
key, 'snap_limit' to the RBD header for implementation. Add object
classes to set and query the limit. Older OSDs will ignore the limit.
Fixes: http://tracker.ceph.com/issues/15706
Signed-off-by: Douglas Fuller <dfuller@redhat.com>
Diffstat (limited to 'src/test/pybind')
-rw-r--r-- | src/test/pybind/test_rbd.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/test/pybind/test_rbd.py b/src/test/pybind/test_rbd.py index 04a3a3820da..bc34b08406c 100644 --- a/src/test/pybind/test_rbd.py +++ b/src/test/pybind/test_rbd.py @@ -12,7 +12,7 @@ from rados import (Rados, LIBRADOS_OP_FLAG_FADVISE_RANDOM) from rbd import (RBD, Image, ImageNotFound, InvalidArgument, ImageExists, ImageBusy, ImageHasSnapshots, ReadOnlyImage, - FunctionNotSupported, ArgumentOutOfRange, + FunctionNotSupported, ArgumentOutOfRange, DiskQuotaExceeded, RBD_FEATURE_LAYERING, RBD_FEATURE_STRIPINGV2, RBD_FEATURE_EXCLUSIVE_LOCK) @@ -502,6 +502,19 @@ class TestImage(object): assert_raises(ImageNotFound, self.image.unprotect_snap, 'snap1') assert_raises(ImageNotFound, self.image.is_protected_snap, 'snap1') + def test_limit_snaps(self): + self.image.set_snap_limit(2) + eq(2, self.image.get_snap_limit()) + self.image.create_snap('snap1') + self.image.create_snap('snap2') + assert_raises(DiskQuotaExceeded, self.image.create_snap, 'snap3') + self.image.remove_snap_limit() + self.image.create_snap('snap3') + + self.image.remove_snap('snap1') + self.image.remove_snap('snap2') + self.image.remove_snap('snap3') + @require_features([RBD_FEATURE_EXCLUSIVE_LOCK]) def test_remove_with_exclusive_lock(self): assert_raises(ImageBusy, remove_image) |