From a946216a162816f28d4d0a8bf0afa15494ec7a33 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 5 Jun 2018 14:21:46 -0500 Subject: [PATCH] mgr/ActivePyModule: expose 'devices' to python modules Signed-off-by: Sage Weil --- src/mgr/ActivePyModules.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/mgr/ActivePyModules.cc b/src/mgr/ActivePyModules.cc index cbd9b9571558f..7bc3d84767b70 100644 --- a/src/mgr/ActivePyModules.cc +++ b/src/mgr/ActivePyModules.cc @@ -287,6 +287,14 @@ PyObject *ActivePyModules::get_python(const std::string &what) } ); return f.get(); + } else if (what == "devices") { + PyFormatter f; + f.open_array_section("devices"); + daemon_state.with_devices([&f] (const DeviceState& dev) { + f.dump_object("device", dev); + }); + f.close_section(); + return f.get(); } else if (what == "io_rate") { PyFormatter f; cluster_state.with_pgmap( -- 2.39.5