From 5b677f3f02500b87757b9965d20151e345b8ba3f Mon Sep 17 00:00:00 2001 From: John Spray Date: Thu, 27 Jul 2017 06:31:01 -0400 Subject: [PATCH] mgr: carry PyModules ref in MonCommandCompletion Signed-off-by: John Spray (cherry picked from commit e938bf9b9d27e192765c805e5f532c9dd4808b21) --- src/mgr/PyState.cc | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/mgr/PyState.cc b/src/mgr/PyState.cc index b701b5fe95802..d919d5af1fa09 100644 --- a/src/mgr/PyState.cc +++ b/src/mgr/PyState.cc @@ -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}, -- 2.39.5