]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/ActivePyModule: expose 'devices' to python modules
authorSage Weil <sage@redhat.com>
Tue, 5 Jun 2018 19:21:46 +0000 (14:21 -0500)
committerSage Weil <sage@redhat.com>
Mon, 11 Jun 2018 12:29:03 +0000 (07:29 -0500)
Signed-off-by: Sage Weil <sage@redhat.com>
src/mgr/ActivePyModules.cc

index cbd9b9571558f2fd12cc0ee82657c244276f2c00..7bc3d84767b70a970ded639c370a4abc668c65b1 100644 (file)
@@ -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(