summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Durgin <josh.durgin@inktank.com>2013-05-16 15:21:24 -0700
committerJosh Durgin <josh.durgin@inktank.com>2013-05-16 15:37:40 -0700
commit4d7058fe2254f335969f05bef649b1a27d470aa4 (patch)
tree87b4496283117aeb3ab8fdebcede10ed494e6c4d
parent82a16c32a37dc46e3019cedc2a5407ae34f806e2 (diff)
downloadceph-4d7058fe2254f335969f05bef649b1a27d470aa4.tar.gz
rbd.py: fix stripe_unit() and stripe_count()
These matched older versions of the functions, but would segfault using the current versions. backport: cuttlefish, bobtail Signed-off-by: Josh Durgin <josh.durgin@inktank.com> (cherry picked from commit 53ee6f965e8f06c7256848210ad3c4f89d0cb5a0)
-rw-r--r--src/pybind/rbd.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/pybind/rbd.py b/src/pybind/rbd.py
index f4d844a17ec..dfd0ba37e36 100644
--- a/src/pybind/rbd.py
+++ b/src/pybind/rbd.py
@@ -653,6 +653,26 @@ class Image(object):
returned %d, but %d was the maximum number of bytes it could have \
written." % (self.name, ret, length))
+ def stripe_unit(self):
+ """
+ Returns the stripe unit used for the image.
+ """
+ stripe_unit = c_uint64()
+ ret = self.librbd.rbd_get_stripe_unit(self.image, byref(stripe_unit))
+ if ret != 0:
+ raise make_ex(ret, 'error getting stripe unit for image' % (self.name))
+ return stripe_unit.value
+
+ def stripe_count(self):
+ """
+ Returns the stripe count used for the image.
+ """
+ stripe_count = c_uint64()
+ ret = self.librbd.rbd_get_stripe_count(self.image, byref(stripe_count))
+ if ret != 0:
+ raise make_ex(ret, 'error getting stripe count for image' % (self.name))
+ return stripe_count.value
+
def flatten(self):
"""
Flatten clone image (copy all blocks from parent to child)