]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
pybind/rbd: deprecate `parent_info` 30793/head
authorRicardo Marques <rimarques@suse.com>
Wed, 9 Oct 2019 09:51:21 +0000 (10:51 +0100)
committerRicardo Marques <rimarques@suse.com>
Wed, 9 Oct 2019 09:51:21 +0000 (10:51 +0100)
`parent_info` is not returning the parent pool namespace
so `get_parent_image_spec` should be used instead.

Signed-off-by: Ricardo Marques <rimarques@suse.com>
src/pybind/rbd/rbd.pyx

index 9aae566c623676c9a828f7fcdf0d9832933d064c..4ebe5b006887b7b148b0f3e7e84fcb807ef18983 100644 (file)
@@ -3186,12 +3186,16 @@ cdef class Image(object):
         """
         return rbd_get_data_pool_id(self.image)
 
-    def parent_info(self):
+    def get_parent_image_spec(self):
         """
-        Get information about a cloned image's parent (if any)
+        Get spec of the cloned image's parent
+
+        :returns: dict - contains the following keys:
+            * ``pool_name`` (str) - parent pool name
+            * ``pool_namespace`` (str) - parent pool namespace
+            * ``image_name`` (str) - parent image name
+            * ``snap_name`` (str) - parent snapshot name
 
-        :returns: tuple - ``(pool name, image name, snapshot name)`` components
-                  of the parent image
         :raises: :class:`ImageNotFound` if the image doesn't have a parent
         """
         cdef:
@@ -3202,14 +3206,28 @@ cdef class Image(object):
         if ret != 0:
             raise make_ex(ret, 'error getting parent info for image %s' % self.name)
 
-        result = (decode_cstr(parent_spec.pool_name),
-                  decode_cstr(parent_spec.image_name),
-                  decode_cstr(snap_spec.name))
+        result = {'pool_name': decode_cstr(parent_spec.pool_name),
+                  'pool_namespace': decode_cstr(parent_spec.pool_namespace),
+                  'image_name': decode_cstr(parent_spec.image_name),
+                  'snap_name': decode_cstr(snap_spec.name)}
 
         rbd_linked_image_spec_cleanup(&parent_spec)
         rbd_snap_spec_cleanup(&snap_spec)
         return result
 
+    def parent_info(self):
+        """
+        Deprecated. Use `get_parent_image_spec` instead.
+
+        Get information about a cloned image's parent (if any)
+
+        :returns: tuple - ``(pool name, image name, snapshot name)`` components
+                  of the parent image
+        :raises: :class:`ImageNotFound` if the image doesn't have a parent
+        """
+        parent = self.get_parent_image_spec()
+        return (parent['pool_name'], parent['image_name'], parent['snap_name'])
+
     def parent_id(self):
         """
         Get image id of a cloned image's parent (if any)