From 870b4e2f358e470cee868111445212b43c3242d1 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Wed, 23 Oct 2019 12:43:45 -0500 Subject: [PATCH] mgr/ActivePyModules: expose 'mds_metadata' to modules Signed-off-by: Sage Weil --- src/mgr/ActivePyModules.cc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/mgr/ActivePyModules.cc b/src/mgr/ActivePyModules.cc index 637821564218b..27dbe175ee287 100644 --- a/src/mgr/ActivePyModules.cc +++ b/src/mgr/ActivePyModules.cc @@ -240,6 +240,20 @@ PyObject *ActivePyModules::get_python(const std::string &what) auto dmc = daemon_state.get_by_service("osd"); PyEval_RestoreThread(tstate); + for (const auto &[key, state] : dmc) { + std::lock_guard l(state->lock); + f.open_object_section(key.name.c_str()); + f.dump_string("hostname", state->hostname); + for (const auto &[name, val] : state->metadata) { + f.dump_string(name.c_str(), val); + } + f.close_section(); + } + return f.get(); + } else if (what == "mds_metadata") { + auto dmc = daemon_state.get_by_service("mds"); + PyEval_RestoreThread(tstate); + for (const auto &[key, state] : dmc) { std::lock_guard l(state->lock); f.open_object_section(key.name.c_str()); -- 2.39.5