]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osdmap: move oneliner summary to separate function
authorSage Weil <sage@inktank.com>
Tue, 13 Aug 2013 22:40:53 +0000 (15:40 -0700)
committerSage Weil <sage@inktank.com>
Tue, 13 Aug 2013 22:40:53 +0000 (15:40 -0700)
We're about to make print_summary() do something much nicer.

Signed-off-by: Sage Weil <sage@inktank.com>
src/osd/OSDMap.cc
src/osd/OSDMap.h

index 36a43ff4b577891e501de6b1d7a86e9abd8f8c20..2c035f46b040474ebee73b1486fa35e0cbd2f929 100644 (file)
@@ -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<int64_t,pg_pool_t>::const_iterator p = pools.begin(); p != pools.end(); ++p) {
index 0badd0abea3412a44714a48acbf7e344916b366e..2b0cbb8020cbde817de4178495f55d313132fb10 100644 (file)
@@ -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<const OSDMap> OSDMapRef;
 
 inline ostream& operator<<(ostream& out, const OSDMap& m) {
-  m.print_summary(NULL, out);
+  m.print_oneline_summary(out);
   return out;
 }