]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr: expose a MgrMap in PyModules
authorJohn Spray <john.spray@redhat.com>
Thu, 22 Jun 2017 00:12:58 +0000 (20:12 -0400)
committerJohn Spray <john.spray@redhat.com>
Fri, 14 Jul 2017 14:05:54 +0000 (10:05 -0400)
Signed-off-by: John Spray <john.spray@redhat.com>
src/mgr/Mgr.cc
src/mgr/Mgr.h
src/mgr/PyModules.cc
src/mgr/PyModules.h

index 9c9ea5d82d304acb919442fa75076162666e9063..aa4cc6a7f7b001c5e8643210de023c1a36bf4c34 100644 (file)
@@ -599,7 +599,9 @@ bool Mgr::got_mgr_map(const MgrMap& m)
         << dendl;
     return true;
   }
+
   cluster_state.set_mgr_map(m);
+
   return false;
 }
 
index fd96a20b6be6cdbacb91314e6aa1b91f9823fd0a..ccf22da9e7c4e91472f04414880e33efd6060c09 100644 (file)
@@ -29,6 +29,7 @@
 #include "auth/Auth.h"
 #include "common/Finisher.h"
 #include "common/Timer.h"
+#include "mon/MgrMap.h"
 
 #include "DaemonServer.h"
 #include "PyModules.h"
index 113dd665d9c4a1b2837147e61cd3c3d84ee9fb08..8412e6cbf5fff238131fcda3065a2d60806f8bc0 100644 (file)
@@ -281,6 +281,12 @@ PyObject *PyModules::get_python(const std::string &what)
     }
     f.dump_string("json", json.to_str());
     return f.get();
+  } else if (what == "mgr_map") {
+    PyFormatter f;
+    cluster_state.with_mgrmap([&f](const MgrMap &mgr_map) {
+      mgr_map.dump(&f);
+    });
+    return f.get();
   } else {
     derr << "Python module requested unknown data '" << what << "'" << dendl;
     Py_RETURN_NONE;
index 8e52e173062ae2f1c5f539a2193ef0fba4bbf532..467555b51a1feca1111631340c1fb08de296e606 100644 (file)
@@ -23,6 +23,7 @@
 #include "osdc/Objecter.h"
 #include "client/Client.h"
 #include "common/LogClient.h"
+#include "mon/MgrMap.h"
 
 #include "DaemonState.h"
 #include "ClusterState.h"