]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: define stream operator for mds_info_t
authorPatrick Donnelly <pdonnell@redhat.com>
Wed, 6 Nov 2019 03:34:41 +0000 (19:34 -0800)
committerPatrick Donnelly <pdonnell@redhat.com>
Fri, 8 Nov 2019 18:02:09 +0000 (10:02 -0800)
This also cleans up the output to be more readable/useful in debug
output.

Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
PendingReleaseNotes
src/mds/FSMap.cc
src/mds/MDSMap.cc
src/mds/MDSMap.h

index 110f3f19bab001ebc5dda213a97d0aae9d48dcba..0a1cf7c65530fa404baf976b50153013cc9f6ae1 100644 (file)
 
     ceph config set global mon_warn_on_pool_pg_num_not_power_of_two false
 
+* The format of MDSs in `ceph fs dump` has changed.
+
 * The ``pg_autoscale_mode`` is now set to ``on`` by default for newly
   created pools, which means that Ceph will automatically manage the
   number of PGs.  To change this behavior, or to learn more about PG
   ``.`` in their name.
 
   Note that this only applies to configuration options in the
-  monitor's database--config file parsing is not affected.
\ No newline at end of file
+  monitor's database--config file parsing is not affected.
index eb7e4120a6aacc76508c653f0173ee82e36cbf4f..4c8cfd29557353cb08ddc9e8c18693b8c6ab5d66 100644 (file)
@@ -131,9 +131,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;
   }
 }
 
index 4ff6c8e500dd1db81458b0d80622ae257fb454d8..0a82aa128a12d5528cb0b81510e2a0e248a5a313 100644 (file)
@@ -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(std::list<mds_info_t*>& 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<mds_rank_t,string> by_rank;
index a4a562d5cb470c8c8e0d16d58d0f31676fc3025c..7f714a52921d7de33df5026a80803b5802e4e51e 100644 (file)
@@ -139,7 +139,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;
@@ -681,4 +681,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