]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr: expose "df" to python modules
authorJohn Spray <john.spray@redhat.com>
Sun, 31 Jul 2016 22:23:54 +0000 (23:23 +0100)
committerJohn Spray <john.spray@redhat.com>
Thu, 29 Sep 2016 16:27:03 +0000 (17:27 +0100)
Signed-off-by: John Spray <john.spray@redhat.com>
src/mgr/ClusterState.h
src/mgr/MgrClient.cc
src/mgr/PyModules.cc

index bd9ee4d06dd4b2f1c6f6a3b2718cb86580f5bd4e..c63ca27604c42a04c36bba48f9e2340646356109 100644 (file)
@@ -98,7 +98,6 @@ public:
   template<typename Callback, typename...Args>
   void with_osdmap(Callback&& cb, Args&&...args)
   {
-    Mutex::Locker l(lock);
     assert(objecter != nullptr);
     objecter->with_osdmap(cb);
   }
index 1cc610c20d24b0fa0bbaabe14a4c5e1403bce2e1..3f32934f707a5aef59f3a12baa338c6ac1f3049b 100644 (file)
@@ -336,3 +336,4 @@ bool MgrClient::handle_command_reply(MCommandReply *m)
   m->put();
   return true;
 }
+
index e7147e736bb90c57298b36f3df4d59f243a84ef1..4cbaccfae7aa5dd98880fa6f4d984ed40a0b2fe9 100644 (file)
@@ -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<std::string, std::map<std::string, uint32_t> > osds;
           std::map<std::string, std::map<std::string, uint32_t> > pools;
           std::map<std::string, uint32_t> 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;