]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/OSDMap: add osd status to utilization dumper 23921/head
authorPaul Emmerich <paul.emmerich@croit.io>
Tue, 4 Sep 2018 21:37:07 +0000 (21:37 +0000)
committerPaul Emmerich <paul.emmerich@croit.io>
Tue, 4 Sep 2018 21:45:20 +0000 (21:45 +0000)
It's mildly irritating that 'osd df' doesn't contain the
information whether an OSD is up/down/destroyed.

Fixes: http://tracker.ceph.com/issues/35544
Signed-off-by: Paul Emmerich <paul.emmerich@croit.io>
src/osd/OSDMap.cc

index ecc2683e66c3feeb3e53268d771a60b2ed27cdff..14c7f94ac65cabe22675d18045ca4d5965f4adda 100644 (file)
@@ -4656,6 +4656,7 @@ public:
     tbl->define_column("%USE", TextTable::LEFT, TextTable::RIGHT);
     tbl->define_column("VAR", TextTable::LEFT, TextTable::RIGHT);
     tbl->define_column("PGS", TextTable::LEFT, TextTable::RIGHT);
+    tbl->define_column("STATUS", TextTable::LEFT, TextTable::RIGHT);
     if (tree)
       tbl->define_column("TYPE NAME", TextTable::LEFT, TextTable::LEFT);
 
@@ -4715,8 +4716,16 @@ protected:
 
     if (qi.is_bucket()) {
       *tbl << "-";
+      *tbl << "";
     } else {
       *tbl << num_pgs;
+      if (osdmap->is_up(qi.id)) {
+        *tbl << "up";
+      } else if (osdmap->is_destroyed(qi.id)) {
+        *tbl << "destroyed";
+      } else {
+        *tbl << "down";
+      }
     }
 
     if (tree) {
@@ -4803,6 +4812,15 @@ protected:
     f->dump_float("utilization", util);
     f->dump_float("var", var);
     f->dump_unsigned("pgs", num_pgs);
+    if (!qi.is_bucket()) {
+      if (osdmap->is_up(qi.id)) {
+        f->dump_string("status", "up");
+      } else if (osdmap->is_destroyed(qi.id)) {
+        f->dump_string("status", "destroyed");
+      } else {
+        f->dump_string("status", "down");
+      }
+    }
     CrushTreeDumper::dump_bucket_children(crush, qi, f);
     f->close_section();
   }