From d0a3dd09ed46a45c8dbd02250b0a08529e6cdb4e Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 29 Jun 2017 09:53:51 -0400 Subject: [PATCH] mon: include class in 'osd df [tree]' output Signed-off-by: Sage Weil --- src/crush/CrushTreeDumper.h | 4 ++++ src/osd/OSDMap.cc | 9 ++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/crush/CrushTreeDumper.h b/src/crush/CrushTreeDumper.h index 70c48c83a6834..ca5a93fce783b 100644 --- a/src/crush/CrushTreeDumper.h +++ b/src/crush/CrushTreeDumper.h @@ -150,6 +150,10 @@ namespace CrushTreeDumper { inline void dump_item_fields(const CrushWrapper *crush, const Item &qi, Formatter *f) { f->dump_int("id", qi.id); + const char *c = crush->get_item_class(qi.id); + if (!c) + c = ""; + f->dump_string("device_class", c); if (qi.is_bucket()) { int type = crush->get_bucket_type(qi.id); f->dump_string("name", crush->get_item_name(qi.id)); diff --git a/src/osd/OSDMap.cc b/src/osd/OSDMap.cc index 2637df618bbd5..6b5a09e5fe2f1 100644 --- a/src/osd/OSDMap.cc +++ b/src/osd/OSDMap.cc @@ -4071,6 +4071,7 @@ public: void dump(TextTable *tbl) { tbl->define_column("ID", TextTable::LEFT, TextTable::RIGHT); + tbl->define_column("CLASS", TextTable::LEFT, TextTable::RIGHT); tbl->define_column("WEIGHT", TextTable::LEFT, TextTable::RIGHT); tbl->define_column("REWEIGHT", TextTable::LEFT, TextTable::RIGHT); tbl->define_column("SIZE", TextTable::LEFT, TextTable::RIGHT); @@ -4086,7 +4087,9 @@ public: dump_stray(tbl); - *tbl << "" << "" << "TOTAL" + *tbl << "" + << "" + << "" << "TOTAL" << si_t(pgs->get_osd_sum().kb << 10) << si_t(pgs->get_osd_sum().kb_used << 10) << si_t(pgs->get_osd_sum().kb_avail << 10) @@ -4112,7 +4115,11 @@ protected: double& var, const size_t num_pgs, TextTable *tbl) override { + const char *c = crush->get_item_class(qi.id); + if (!c) + c = ""; *tbl << qi.id + << c << weightf_t(qi.weight) << weightf_t(reweight) << si_t(kb << 10) -- 2.39.5