]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
doc/rados/api/python: Add documentation for mon_command
authorSebastian Wagner <sebastian.wagner@suse.com>
Wed, 13 Mar 2019 15:35:41 +0000 (16:35 +0100)
committerSebastian Wagner <sebastian.wagner@suse.com>
Mon, 18 Mar 2019 10:55:56 +0000 (11:55 +0100)
Co-authored-by: Nathan Cutler <ncutler@suse.com>
Signed-off-by: Sebastian Wagner <sebastian.wagner@suse.com>
doc/rados/api/python.rst
src/pybind/rados/rados.pyx

index 977b603ff89cc60ea22e90c59b9befcc2119339e..222a5b193e1c25aa37fd8404c10d1881c3f7a477 100644 (file)
@@ -319,6 +319,18 @@ exists,  and delete a pool.
 .. automethod:: Rados.delete_pool(pool_name)
 
 
+CLI Commands
+------------
+
+The Ceph CLI command is internally using the following librados Python binding methods.
+
+In order to send a command, choose the correct method and choose the correct target.
+
+.. automethod:: Rados.mon_command
+.. automethod:: Rados.osd_command
+.. automethod:: Rados.mgr_command
+.. automethod:: Rados.pg_command
+
 
 Input/Output Context API
 ========================
index 052c491517df838e010923d9094ee6859b21c615..b05efff7e943bdbda66e23a43097c0e9832ca85e 100644 (file)
@@ -1236,8 +1236,23 @@ Rados object in state %s." % self.state)
 
     def mon_command(self, cmd, inbuf, timeout=0, target=None):
         """
+        Send a command to the mon.
+
         mon_command[_target](cmd, inbuf, outbuf, outbuflen, outs, outslen)
-        returns (int ret, string outbuf, string outs)
+
+        :param cmd: JSON formatted string.
+        :param inbuf: optional string.
+        :param timeout: This parameter is ignored.
+        :param target: name of a specific mon. Optional
+        :return: (int ret, string outbuf, string outs)
+
+        Example:
+
+        >>> import json
+        >>> c = Rados(conffile='/etc/ceph/ceph.conf')
+        >>> c.connect()
+        >>> cmd = json.dumps({"prefix": "osd safe-to-destroy", "ids": ["2"], "format": "json"})
+        >>> c.mon_command(cmd, b'')
         """
         # NOTE(sileht): timeout is ignored because C API doesn't provide
         # timeout argument, but we keep it for backward compat with old python binding
@@ -1294,7 +1309,8 @@ Rados object in state %s." % self.state)
     def osd_command(self, osdid, cmd, inbuf, timeout=0):
         """
         osd_command(osdid, cmd, inbuf, outbuf, outbuflen, outs, outslen)
-        returns (int ret, string outbuf, string outs)
+
+        :return: (int ret, string outbuf, string outs)
         """
         # NOTE(sileht): timeout is ignored because C API doesn't provide
         # timeout argument, but we keep it for backward compat with old python binding
@@ -1336,7 +1352,7 @@ Rados object in state %s." % self.state)
 
     def mgr_command(self, cmd, inbuf, timeout=0):
         """
-        returns (int ret, string outbuf, string outs)
+        :return: (int ret, string outbuf, string outs)
         """
         # NOTE(sileht): timeout is ignored because C API doesn't provide
         # timeout argument, but we keep it for backward compat with old python binding
@@ -1378,7 +1394,8 @@ Rados object in state %s." % self.state)
     def pg_command(self, pgid, cmd, inbuf, timeout=0):
         """
         pg_command(pgid, cmd, inbuf, outbuf, outbuflen, outs, outslen)
-        returns (int ret, string outbuf, string outs)
+
+        :return: (int ret, string outbuf, string outs)
         """
         # NOTE(sileht): timeout is ignored because C API doesn't provide
         # timeout argument, but we keep it for backward compat with old python binding