From: John Spray Date: Sun, 31 Jul 2016 22:23:54 +0000 (+0100) Subject: mgr: expose "df" to python modules X-Git-Tag: v11.0.1~60^2~27 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ea46778e3681e5ed6b322f68ab40747b2e052433;p=ceph.git mgr: expose "df" to python modules Signed-off-by: John Spray --- diff --git a/src/mgr/ClusterState.h b/src/mgr/ClusterState.h index bd9ee4d06dd4b..c63ca27604c42 100644 --- a/src/mgr/ClusterState.h +++ b/src/mgr/ClusterState.h @@ -98,7 +98,6 @@ public: template void with_osdmap(Callback&& cb, Args&&...args) { - Mutex::Locker l(lock); assert(objecter != nullptr); objecter->with_osdmap(cb); } diff --git a/src/mgr/MgrClient.cc b/src/mgr/MgrClient.cc index 1cc610c20d24b..3f32934f707a5 100644 --- a/src/mgr/MgrClient.cc +++ b/src/mgr/MgrClient.cc @@ -336,3 +336,4 @@ bool MgrClient::handle_command_reply(MCommandReply *m) m->put(); return true; } + diff --git a/src/mgr/PyModules.cc b/src/mgr/PyModules.cc index e7147e736bb90..4cbaccfae7aa5 100644 --- a/src/mgr/PyModules.cc +++ b/src/mgr/PyModules.cc @@ -177,7 +177,6 @@ PyObject *PyModules::get_python(const std::string &what) PyFormatter f; cluster_state.with_pgmap( [&f](const PGMap &pg_map) { - // f.open_object_section("outer"); std::map > osds; std::map > pools; std::map all; @@ -214,11 +213,21 @@ PyObject *PyModules::get_python(const std::string &what) f.dump_int(i.first.c_str(), i.second); } f.close_section(); - // f.close_section(); } ); return f.get(); + } else if (what == "df") { + PyFormatter f; + + cluster_state.with_osdmap([this, &f](const OSDMap &osd_map){ + cluster_state.with_pgmap( + [osd_map, &f](const PGMap &pg_map) { + pg_map.dump_fs_stats(nullptr, &f, true); + pg_map.dump_pool_stats(osd_map, nullptr, &f, true); + }); + }); + return f.get(); } else if (what == "health" || what == "mon_status") { PyFormatter f; bufferlist json;