From: Sage Weil Date: Tue, 13 Aug 2013 22:40:53 +0000 (-0700) Subject: osdmap: move oneliner summary to separate function X-Git-Tag: v0.68~69^2~11 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f417b10196ae6b7b4674861507e25366be34f948;p=ceph.git osdmap: move oneliner summary to separate function We're about to make print_summary() do something much nicer. Signed-off-by: Sage Weil --- diff --git a/src/osd/OSDMap.cc b/src/osd/OSDMap.cc index 36a43ff4b577..2c035f46b040 100644 --- a/src/osd/OSDMap.cc +++ b/src/osd/OSDMap.cc @@ -1754,6 +1754,18 @@ void OSDMap::print_summary(Formatter *f, ostream& out) const } } +void OSDMap::print_oneline_summary(ostream& out) const +{ + out << "e" << get_epoch() << ": " + << get_num_osds() << " osds: " + << get_num_up_osds() << " up, " + << get_num_in_osds() << " in"; + if (test_flag(CEPH_OSDMAP_FULL)) + out << " full"; + else if (test_flag(CEPH_OSDMAP_NEARFULL)) + out << " nearfull"; +} + bool OSDMap::crush_ruleset_in_use(int ruleset) const { for (map::const_iterator p = pools.begin(); p != pools.end(); ++p) { diff --git a/src/osd/OSDMap.h b/src/osd/OSDMap.h index 0badd0abea34..2b0cbb8020cb 100644 --- a/src/osd/OSDMap.h +++ b/src/osd/OSDMap.h @@ -606,6 +606,7 @@ private: public: void print(ostream& out) const; void print_summary(Formatter *f, ostream& out) const; + void print_oneline_summary(ostream& out) const; void print_tree(ostream *out, Formatter *f) const; string get_flag_string() const; @@ -621,7 +622,7 @@ WRITE_CLASS_ENCODER_FEATURES(OSDMap::Incremental) typedef std::tr1::shared_ptr OSDMapRef; inline ostream& operator<<(ostream& out, const OSDMap& m) { - m.print_summary(NULL, out); + m.print_oneline_summary(out); return out; }