From: Patrick Donnelly Date: Wed, 5 Feb 2025 16:19:25 +0000 (-0500) Subject: mgr: add module method to send notifications X-Git-Tag: v20.0.0^2~11 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=b3ec7385ab2755fa3fa98ab98ed03257c93d315c;p=ceph.git mgr: add module method to send notifications For use by MgrModule.send_command to signal MDS command completion. Signed-off-by: Patrick Donnelly --- diff --git a/src/mgr/BaseMgrModule.cc b/src/mgr/BaseMgrModule.cc index bae5d54d74790..8ec4fc51989eb 100644 --- a/src/mgr/BaseMgrModule.cc +++ b/src/mgr/BaseMgrModule.cc @@ -362,6 +362,20 @@ ceph_set_health_checks(BaseMgrModule *self, PyObject *args) Py_RETURN_NONE; } +static PyObject* +ceph_notify_all(BaseMgrModule *self, PyObject *args) +{ + char *type = nullptr; + char *id = nullptr; + if (!PyArg_ParseTuple(args, "ss:ceph_notify_all", &type, &id)) { + return nullptr; + } + + without_gil([&] { + self->py_modules->notify_all(type, id); + }); + return nullptr; +} static PyObject* ceph_state_get(BaseMgrModule *self, PyObject *args) @@ -1422,6 +1436,9 @@ PyMethodDef BaseMgrModule_methods[] = { {"_ceph_get", (PyCFunction)ceph_state_get, METH_VARARGS, "Get a cluster object"}, + {"_ceph_notify_all", (PyCFunction)ceph_notify_all, METH_VARARGS, + "notify all modules"}, + {"_ceph_get_server", (PyCFunction)ceph_get_server, METH_VARARGS, "Get a server object"}, diff --git a/src/pybind/mgr/ceph_module.pyi b/src/pybind/mgr/ceph_module.pyi index 3777c469a1fdd..32c9a24414800 100644 --- a/src/pybind/mgr/ceph_module.pyi +++ b/src/pybind/mgr/ceph_module.pyi @@ -69,6 +69,7 @@ class BaseMgrModule(object): def _ceph_cluster_log(self, channel: str, priority: int, message: str) -> None: ... def _ceph_get_context(self) -> object: ... def _ceph_get(self, data_name: str) -> Any: ... + def _ceph_notify_all(self, what: str, tag: str) -> None: ... def _ceph_get_server(self, hostname: Optional[str]) -> Union[ServerInfoT, List[ServerInfoT]]: ... def _ceph_get_perf_schema(self, svc_type: str, svc_name: str) -> Dict[str, Any]: ...