mon: include stretch mode status in more outputs

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>
This commit is contained in:
Greg Farnum 2020-11-05 00:07:01 +00:00
parent 41d7dcc1b7
commit 1ff3352b3b
5 changed files with 23 additions and 2 deletions

View 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();

View 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";

View 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

View 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

View File

@ -796,6 +796,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 15296 pgp_num 15296 autoscale_mode on last_change 0 flags hashpspool stripe_width 0 application rbd