From: John Spray Date: Thu, 27 Jul 2017 10:31:01 +0000 (-0400) Subject: mgr: carry PyModules ref in MonCommandCompletion X-Git-Tag: v12.2.2~61^2~30 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=5b677f3f02500b87757b9965d20151e345b8ba3f;p=ceph.git mgr: carry PyModules ref in MonCommandCompletion Signed-off-by: John Spray (cherry picked from commit e938bf9b9d27e192765c805e5f532c9dd4808b21) --- diff --git a/src/mgr/PyState.cc b/src/mgr/PyState.cc index b701b5fe9580..d919d5af1fa0 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},