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-21 14:17:40 -0700
commit684444f88f2a7cf28f2e685c18f0771730a1d48f (patch)
treea6ca42c5811fdce05c889f0824ee99247c1bb8fa
parent9c7faf957fffb2721ccb915b68ca90ffb0d04a9f (diff)
downloadceph-684444f88f2a7cf28f2e685c18f0771730a1d48f.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.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/pybind/rbd.py b/src/pybind/rbd.py
index c5cef9dee42..3683f03c53c 100644
--- a/src/pybind/rbd.py
+++ b/src/pybind/rbd.py
@@ -734,15 +734,21 @@ written." % (self.name, ret, length))
"""
Returns the stripe unit used for the image.
"""
- ret = self.librbd.rbd_get_stripe_unit()
- return ret.value
+ 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.
"""
- ret = self.librbd.rbd_get_stripe_count()
- return ret.value
+ 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):
"""