]> git.apps.os.sepia.ceph.com Git - ceph-ci.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>
Thu, 17 Dec 2020 07:37:02 +0000 (08:37 +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>
src/mgr/BaseMgrModule.cc
src/pybind/mgr/ceph_module.pyi

index 49b5f5627c1a0f3e209965cc736bc8165803b54b..ccfab8de711a72544fdf2621753c52ccb44f77cf 100644 (file)
@@ -125,12 +125,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
@@ -163,7 +171,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));
@@ -183,7 +191,7 @@ ceph_send_command(BaseMgrModule *self, PyObject *args)
     self->py_modules->get_objecter().osd_command(
         osd_id,
         {cmd_json},
-        {},
+        inbuf,
         &tid,
        [command_c, f = &self->py_modules->cmd_finisher]
        (boost::system::error_code ec, std::string s, ceph::buffer::list bl) {
@@ -195,7 +203,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));
@@ -221,7 +229,7 @@ ceph_send_command(BaseMgrModule *self, PyObject *args)
     self->py_modules->get_objecter().pg_command(
         pgid,
         {cmd_json},
-        {},
+        inbuf,
         &tid,
        [command_c, f = &self->py_modules->cmd_finisher]
        (boost::system::error_code ec, std::string s, ceph::buffer::list bl) {
@@ -354,7 +362,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;
 }
 
index bb61ffafc9c311b26e039e2b411a6354682b40d9..dfa4a3dff440d3992a7afc614d176cabebe43f76 100644 (file)
@@ -49,7 +49,7 @@ class BaseMgrModule(object):
     def _ceph_get_latest_counter(self, svc_type, svc_name, path):...
     def _ceph_get_metadata(self, svc_type, svc_id):...
     def _ceph_get_daemon_status(self, svc_type, svc_id):...
-    def _ceph_send_command(self, *args, **kwargs):...
+    def _ceph_send_command(self, result, svc_type, svc_id, command, tag, inbuf):...
     def _ceph_set_health_checks(self, checks):...
     def _ceph_get_mgr_id(self):...
     def _ceph_get_option(self, key):...