]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: include stretch mode status in more outputs
authorGreg Farnum <gfarnum@redhat.com>
Thu, 5 Nov 2020 00:07:01 +0000 (00:07 +0000)
committerGreg Farnum <gfarnum@redhat.com>
Fri, 6 Nov 2020 06:39:33 +0000 (06:39 +0000)
It was missing from the monmap dump, and included in OSDMap::dump()
but not the OSDMap::print() which is used for text-based CLI queries.

Signed-off-by: Greg Farnum <gfarnum@redhat.com>
src/mon/MonMap.cc
src/osd/OSDMap.cc
src/test/cli/osdmaptool/clobber.t
src/test/cli/osdmaptool/create-print.t
src/test/cli/osdmaptool/create-racks.t

index be0a6c678916ef0385dd59ff2a995f57ce172999..8aa1fd4ffa6051fe7c40644dba0669f34dfb0682 100644 (file)
@@ -374,7 +374,13 @@ void MonMap::print(ostream& out) const
   }
   unsigned i = 0;
   for (auto p = ranks.begin(); p != ranks.end(); ++p) {
-    out << i++ << ": " << get_addrs(*p) << " mon." << *p << "\n";
+    const auto &mi = mon_info.find(*p);
+    ceph_assert(mi != mon_info.end());
+    out << i++ << ": " << mi->second.public_addrs << " mon." << *p;
+    if (!mi->second.crush_loc.empty()) {
+      out << "; crush_location " << mi->second.crush_loc;
+    }
+    out << "\n";
   }
 }
 
@@ -387,7 +393,8 @@ void MonMap::dump(Formatter *f) const
   f->dump_unsigned("min_mon_release", to_integer<unsigned>(min_mon_release));
   f->dump_string("min_mon_release_name", to_string(min_mon_release));
   f->dump_int ("election_strategy", strategy);
-  f->dump_stream("disallowed_leaders") << disallowed_leaders;
+  f->dump_stream("disallowed_leaders: ") << disallowed_leaders;
+  f->dump_bool("stretch_mode", stretch_mode_enabled);
   f->open_object_section("features");
   persistent_features.dump(f, "persistent");
   optional_features.dump(f, "optional");
@@ -404,6 +411,9 @@ void MonMap::dump(Formatter *f) const
     f->dump_stream("public_addr") << get_addrs(*p).get_legacy_str();
     f->dump_unsigned("priority", get_priority(*p));
     f->dump_unsigned("weight", get_weight(*p));
+    const auto &mi = mon_info.find(*p);
+    // we don't need to assert this validity as all the get_* functions did
+    f->dump_stream("crush_location") << mi->second.crush_loc;
     f->close_section();
   }
   f->close_section();
index 196a6ea39b66f4ad2ad6459cd4018105b8c78cf4..68922395c680e42b55ec20de4a320cff9407eb63 100644 (file)
@@ -3878,6 +3878,13 @@ void OSDMap::print(ostream& out) const
     out << "require_osd_release " << require_osd_release
        << "\n";
   }
+  out << "stretch_mode_enabled " << (stretch_mode_enabled ? "true" : "false") << "\n";
+  if (stretch_mode_enabled) {
+    out << "stretch_bucket_count " << stretch_bucket_count << "\n";
+    out << "degraded_stretch_mode " << degraded_stretch_mode << "\n";
+    out << "recovering_stretch_mode " << recovering_stretch_mode << "\n";
+    out << "stretch_mode_bucket " << stretch_mode_bucket << "\n";
+  }
   if (get_cluster_snapshot().length())
     out << "cluster_snapshot " << get_cluster_snapshot() << "\n";
   out << "\n";
index c78138c9b632a78460d81aeef4e18d406baefb91..1469606939e73658f3bc55fa4e443816c20e08f4 100644 (file)
@@ -24,6 +24,7 @@
   backfillfull_ratio 0
   nearfull_ratio 0
   min_compat_client jewel
+  stretch_mode_enabled false
   
   pool 1 'rbd' replicated size 3 min_size 2 crush_rule 0 object_hash rjenkins pg_num 192 pgp_num 192 autoscale_mode on last_change 0 flags hashpspool stripe_width 0 application rbd
   
@@ -50,6 +51,7 @@
   backfillfull_ratio 0
   nearfull_ratio 0
   min_compat_client jewel
+  stretch_mode_enabled false
   
   pool 1 'rbd' replicated size 3 min_size 2 crush_rule 0 object_hash rjenkins pg_num 64 pgp_num 64 autoscale_mode on last_change 0 flags hashpspool stripe_width 0 application rbd
   
index 7f3a033c2d49c5e961c805f75b8213894f4baaf7..366e62185b4883f2839fb43f714f0aa0b38a070b 100644 (file)
@@ -84,6 +84,7 @@
   backfillfull_ratio 0
   nearfull_ratio 0
   min_compat_client jewel
+  stretch_mode_enabled false
   
   pool 1 'rbd' replicated size 3 min_size 2 crush_rule 0 object_hash rjenkins pg_num 192 pgp_num 192 autoscale_mode on last_change 0 flags hashpspool stripe_width 0 application rbd
   
index 6a27cb07de513fd51502f02f2c278ee92ad035ea..2fe5c4927d204db8c3892ffa6a39ed68c8a2348a 100644 (file)
   backfillfull_ratio 0
   nearfull_ratio 0
   min_compat_client jewel
+  stretch_mode_enabled false
   
   pool 1 'rbd' replicated size 3 min_size 2 crush_rule 0 object_hash rjenkins pg_num 15296 pgp_num 15296 autoscale_mode on last_change 0 flags hashpspool stripe_width 0 application rbd