From: Patrick Donnelly Date: Wed, 6 Nov 2019 03:34:41 +0000 (-0800) Subject: mds: define stream operator for mds_info_t X-Git-Tag: v14.2.10~168^2~11 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=341ea5b50de9e90e9dfbfc20ed3d7ef8c4f974c3;p=ceph.git mds: define stream operator for mds_info_t This also cleans up the output to be more readable/useful in debug output. Signed-off-by: Patrick Donnelly (cherry picked from commit 1c56632e88a126d0eac75235d9a9716833cba6b7) Conflicts: PendingReleaseNotes Fix minor conflict in PendingReleaseNotes. --- diff --git a/PendingReleaseNotes b/PendingReleaseNotes index 0376f3caf05d..a48aee634ab4 100644 --- a/PendingReleaseNotes +++ b/PendingReleaseNotes @@ -13,3 +13,5 @@ the upgrade:: ceph osd pool set pg_autoscale_mode warn + +* The format of MDSs in `ceph fs dump` has changed. diff --git a/src/mds/FSMap.cc b/src/mds/FSMap.cc index e395f2dcbcc8..cce68614cbdb 100644 --- a/src/mds/FSMap.cc +++ b/src/mds/FSMap.cc @@ -111,9 +111,8 @@ void FSMap::print(ostream& out) const out << "Standby daemons:" << std::endl << " " << std::endl; } - for (const auto &p : standby_daemons) { - p.second.print_summary(out); - out << std::endl; + for (const auto& p : standby_daemons) { + out << p.second << std::endl; } } diff --git a/src/mds/MDSMap.cc b/src/mds/MDSMap.cc index 4b213cf70438..b792ca8e684d 100644 --- a/src/mds/MDSMap.cc +++ b/src/mds/MDSMap.cc @@ -92,24 +92,21 @@ void MDSMap::mds_info_t::dump(Formatter *f) const f->dump_unsigned("flags", flags); } -void MDSMap::mds_info_t::print_summary(ostream &out) const +void MDSMap::mds_info_t::dump(std::ostream& o) const { - out << global_id << ":\t" - << addrs - << " '" << name << "'" - << " mds." << rank - << "." << inc - << " " << ceph_mds_state_name(state) - << " seq " << state_seq; + o << "[mds." << name << "{" << rank << ":" << global_id << "}" + << " state " << ceph_mds_state_name(state) + << " seq " << state_seq; if (laggy()) { - out << " laggy since " << laggy_since; + o << " laggy since " << laggy_since; } if (!export_targets.empty()) { - out << " export_targets=" << export_targets; + o << " export targets " << export_targets; } if (is_frozen()) { - out << " frozen"; + o << " frozen"; } + o << " addr " << addrs << "]"; } void MDSMap::mds_info_t::generate_test_instances(list& ls) @@ -239,14 +236,10 @@ void MDSMap::print(ostream& out) const } for (const auto &p : foo) { - const mds_info_t& info = mds_info.at(p.second); - info.print_summary(out); - out << "\n"; + out << mds_info.at(p.second) << "\n"; } } - - void MDSMap::print_summary(Formatter *f, ostream *out) const { map by_rank; diff --git a/src/mds/MDSMap.h b/src/mds/MDSMap.h index 5ba266a4294f..80ebbbf7d59c 100644 --- a/src/mds/MDSMap.h +++ b/src/mds/MDSMap.h @@ -138,7 +138,7 @@ public: } void decode(bufferlist::const_iterator& p); void dump(Formatter *f) const; - void print_summary(ostream &out) const; + void dump(std::ostream&) const; // The long form name for use in cluster log messages` std::string human_name() const; @@ -680,4 +680,9 @@ inline ostream& operator<<(ostream &out, const MDSMap &m) { return out; } +inline std::ostream& operator<<(std::ostream& o, const MDSMap::mds_info_t& info) { + info.dump(o); + return o; +} + #endif