Project

General

Profile

Actions

Documentation #61634

open

Librbd (Python) rbd.Image API reference missing most methods

Added by melanie witt 11 months ago. Updated 11 months ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
% Done:

0%

Tags:
Backport:
Reviewed:
Affected Versions:
Pull request ID:

Description

I'm not sure if there is any way to fix this but ...

The Librbd (Python) documentation for the rbd.Image module currently contains only two methods [1]:

and I think this might be because of the @requires_not_closed [2] decorator on most of the methods:

def requires_not_closed(f):
    def wrapper(self, *args, **kwargs):
        self.require_not_closed()
        return f(self, *args, **kwargs)

which calls

    def require_not_closed(self):
        """ 
        Checks if the Image is not closed

        :raises: :class:`InvalidArgument`
        """ 
        if self.closed:
            raise InvalidArgument("image is closed")

and self.closed defaults to True:

    def __init__(self, ioctx, name=None, snapshot=None,
                 read_only=False, image_id=None, _oncomplete=None):
        """ 
        Open the image at the given snapshot.
        Specify either name or id, otherwise :class:`InvalidArgument` is raised.

        If a snapshot is specified, the image will be read-only, unless
        :func:`Image.set_snap` is called later.

        If read-only mode is used, metadata for the :class:`Image`
        object (such as which snapshots exist) may become obsolete. See
        the C api for more details.

        To clean up from opening the image, :func:`Image.close` should
        be called.  For ease of use, this is done automatically when
        an :class:`Image` is used as a context manager (see :pep:`343`).

        :param ioctx: determines which RADOS pool the image is in
        :type ioctx: :class:`rados.Ioctx`
        :param name: the name of the image
        :type name: str
        :param snapshot: which snapshot to read from
        :type snapshot: str
        :param read_only: whether to open the image in read-only mode
        :type read_only: bool
        :param image_id: the id of the image
        :type image_id: str
        """ 
        name = cstr(name, 'name', opt=True)
        image_id = cstr(image_id, 'image_id', opt=True)
        snapshot = cstr(snapshot, 'snapshot', opt=True)
        self.closed = True

So those methods with the decorator on them end up not being returned when the doc is generated and they get left out of the doc.

[1] https://docs.ceph.com/en/quincy/rbd/api/librbdpy/#rbd.Image
[2] https://github.com/ceph/ceph/blob/219d315/src/pybind/rbd/rbd.pyx#L2768


Files

screenshot.png (118 KB) screenshot.png melanie witt, 06/09/2023 09:30 PM
Actions #1

Updated by melanie witt 11 months ago

I filed this issue under the wrong project by accident and it should be closed.

I filed a new issue under the correct (hopefully) project here:

https://tracker.ceph.com/issues/61635

Actions

Also available in: Atom PDF