]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
pybind/rbd: add `data_pool_id()` image function
authorRicardo Dias <rdias@suse.com>
Tue, 27 Mar 2018 12:41:26 +0000 (13:41 +0100)
committerNathan Cutler <ncutler@suse.com>
Sun, 29 Apr 2018 09:37:07 +0000 (11:37 +0200)
Fixes: http://tracker.ceph.com/issues/23609
Signed-off-by: Ricardo Dias <rdias@suse.com>
(cherry picked from commit e127ec64b4fe900ec044521b130f7b83afd2161b)

src/pybind/rbd/rbd.pyx

index 5fd8e63ce50320fa71519dcf404b3a9edc687561..4829c96bf397afb905d3bfbcd5ecd48f2b5e32a8 100644 (file)
@@ -233,6 +233,7 @@ cdef extern from "rbd/librbd.h" nogil:
     int rbd_get_id(rbd_image_t image, char *id, size_t id_len)
     int rbd_get_block_name_prefix(rbd_image_t image, char *prefix,
                                   size_t prefix_len)
+    int64_t rbd_get_data_pool_id(rbd_image_t image)
     int rbd_get_parent_info2(rbd_image_t image,
                              char *parent_poolname, size_t ppoolnamelen,
                              char *parent_name, size_t pnamelen,
@@ -1553,6 +1554,14 @@ cdef class Image(object):
         finally:
             free(prefix)
 
+    def data_pool_id(self):
+        """
+        Get the pool id of the pool where the data of this RBD image is stored.
+
+        :returns: int - the pool id
+        """
+        return rbd_get_data_pool_id(self.image)
+
     def parent_info(self):
         """
         Get information about a cloned image's parent (if any)