]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr: carry PyModules ref in MonCommandCompletion
authorJohn Spray <john.spray@redhat.com>
Thu, 27 Jul 2017 10:31:01 +0000 (06:31 -0400)
committerJohn Spray <john.spray@redhat.com>
Wed, 1 Nov 2017 23:03:27 +0000 (23:03 +0000)
Signed-off-by: John Spray <john.spray@redhat.com>
(cherry picked from commit e938bf9b9d27e192765c805e5f532c9dd4808b21)

src/mgr/PyState.cc

index b701b5fe95802a6a296007b44e01310540d1e817..d919d5af1fa099cbac95b660a4ca28001946c3b2 100644 (file)
@@ -41,6 +41,7 @@ typedef struct {
 
 class MonCommandCompletion : public Context
 {
+  PyModules *py_modules;
   PyObject *python_completion;
   const std::string tag;
   SafeThreadState pThreadState;
@@ -49,8 +50,11 @@ public:
   std::string outs;
   bufferlist outbl;
 
-  MonCommandCompletion(PyObject* ev, const std::string &tag_, PyThreadState *ts_)
-    : python_completion(ev), tag(tag_), pThreadState(ts_)
+  MonCommandCompletion(
+      PyModules *py_modules_, PyObject* ev,
+      const std::string &tag_, PyThreadState *ts_)
+    : py_modules(py_modules_), python_completion(ev),
+      tag(tag_), pThreadState(ts_)
   {
     assert(python_completion != nullptr);
     Py_INCREF(python_completion);
@@ -87,7 +91,7 @@ public:
       }
       Py_DECREF(args);
     }
-    //global_handle->notify_all("command", tag);
+    py_modules->notify_all("command", tag);
   }
 };
 
@@ -117,7 +121,8 @@ ceph_send_command(BaseMgrModule *self, PyObject *args)
   }
   Py_DECREF(set_fn);
 
-  auto c = new MonCommandCompletion(completion, tag, PyThreadState_Get());
+  auto c = new MonCommandCompletion(self->py_modules,
+      completion, tag, PyThreadState_Get());
   if (std::string(type) == "mon") {
     self->py_modules->get_monc().start_mon_command(
         {cmd_json},