]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd.py: fix stripe_unit() and stripe_count()
authorJosh Durgin <josh.durgin@inktank.com>
Thu, 16 May 2013 22:21:24 +0000 (15:21 -0700)
committerJosh Durgin <josh.durgin@inktank.com>
Tue, 21 May 2013 21:17:40 +0000 (14:17 -0700)
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)

src/pybind/rbd.py

index c5cef9dee42efd5c3bc70dea62d35b5953db2e75..3683f03c53cf2f513a644666e4fdb318641cf98a 100644 (file)
@@ -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):
         """