]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/osd: add OSD::dump_status()
authorKefu Chai <kchai@redhat.com>
Sun, 16 Feb 2020 06:10:25 +0000 (14:10 +0800)
committerKefu Chai <kchai@redhat.com>
Sun, 16 Feb 2020 15:59:30 +0000 (23:59 +0800)
so it can be used by asock command

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/crimson/osd/osd.cc
src/crimson/osd/osd.h

index 18b6fa62a8666d8c0799c40d6be5696f839efacc..21faffd3bff9024d11f5804016a0646191d33553 100644 (file)
@@ -440,6 +440,17 @@ seastar::future<> OSD::stop()
   });
 }
 
+void OSD::dump_status(Formatter* f) const
+{
+  f->dump_stream("cluster_fsid") << superblock.cluster_fsid;
+  f->dump_stream("osd_fsid") << superblock.osd_fsid;
+  f->dump_unsigned("whoami", superblock.whoami);
+  f->dump_string("state", state.to_string());
+  f->dump_unsigned("oldest_map", superblock.oldest_map);
+  f->dump_unsigned("newest_map", superblock.newest_map);
+  f->dump_unsigned("num_pgs", pg_map.get_pgs().size());
+}
+
 seastar::future<> OSD::load_pgs()
 {
   return store->list_collections().then([this](auto colls) {
index 0630793f44f42406ab6f1a0fa882d8564770943d..45dffb44fdcf4140c7713963333249b6517a5fae 100644 (file)
@@ -131,6 +131,8 @@ public:
   seastar::future<> start();
   seastar::future<> stop();
 
+  void dump_status(Formatter*) const;
+
 private:
   seastar::future<> start_boot();
   seastar::future<> _preboot(version_t oldest_osdmap, version_t newest_osdmap);