]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/BaseMgrModule: add optional inbuf param to ceph_send_command.
authorAlfonso Martínez <almartin@redhat.com>
Tue, 15 Dec 2020 08:29:53 +0000 (09:29 +0100)
committerAlfonso Martínez <almartin@redhat.com>
Fri, 8 Jan 2021 18:48:01 +0000 (19:48 +0100)
BaseMgrModule.cc: ceph_send_command: add inbuf param for handling input file content.

Fixes: https://tracker.ceph.com/issues/48355
Signed-off-by: Ernesto Puerta <epuertat@redhat.com>
(cherry picked from commit dc37e0fdb1ea5187aea42303f0bfe27aadd8d64d)

 Conflicts:
src/pybind/mgr/ceph_module.pyi

 - Remove this file as it does not exist in nautilus.

src/mgr/BaseMgrModule.cc

index a2610517ab2881bc92f83b6b5d3f70839d308a3a..0f8f0b6de10f3e261fa4b566f68adfd97ecd6f54 100644 (file)
@@ -123,12 +123,20 @@ ceph_send_command(BaseMgrModule *self, PyObject *args)
 
   char *cmd_json = nullptr;
   char *tag = nullptr;
+  char *inbuf_ptr = nullptr;
+  Py_ssize_t inbuf_len = 0;
+  bufferlist inbuf = {};
+
   PyObject *completion = nullptr;
-  if (!PyArg_ParseTuple(args, "Ossss:ceph_send_command",
-        &completion, &type, &name, &cmd_json, &tag)) {
+  if (!PyArg_ParseTuple(args, "Ossssz#:ceph_send_command",
+        &completion, &type, &name, &cmd_json, &tag, &inbuf_ptr, &inbuf_len)) {
     return nullptr;
   }
 
+  if (inbuf_ptr) {
+    inbuf.append(inbuf_ptr, (unsigned)inbuf_len);
+  }
+
   auto set_fn = PyObject_GetAttrString(completion, "complete");
   if (set_fn == nullptr) {
     ceph_abort();  // TODO raise python exception instead
@@ -162,7 +170,7 @@ ceph_send_command(BaseMgrModule *self, PyObject *args)
     self->py_modules->get_monc().start_mon_command(
         name,
         {cmd_json},
-        {},
+        inbuf,
         &command_c->outbl,
         &command_c->outs,
         new C_OnFinisher(c, &self->py_modules->cmd_finisher));
@@ -182,7 +190,7 @@ ceph_send_command(BaseMgrModule *self, PyObject *args)
     self->py_modules->get_objecter().osd_command(
         osd_id,
         {cmd_json},
-        {},
+        inbuf,
         &tid,
         &command_c->outbl,
         &command_c->outs,
@@ -191,7 +199,7 @@ ceph_send_command(BaseMgrModule *self, PyObject *args)
     int r = self->py_modules->get_client().mds_command(
         name,
         {cmd_json},
-        {},
+        inbuf,
         &command_c->outbl,
         &command_c->outs,
         new C_OnFinisher(command_c, &self->py_modules->cmd_finisher));
@@ -217,7 +225,7 @@ ceph_send_command(BaseMgrModule *self, PyObject *args)
     self->py_modules->get_objecter().pg_command(
         pgid,
         {cmd_json},
-        {},
+        inbuf,
         &tid,
         &command_c->outbl,
         &command_c->outs,
@@ -337,7 +345,7 @@ ceph_set_health_checks(BaseMgrModule *self, PyObject *args)
   self->py_modules->set_health_checks(self->this_module->get_name(),
                                       std::move(out_checks));
   PyEval_RestoreThread(tstate);
-  
+
   Py_RETURN_NONE;
 }