From: Patrick Donnelly Date: Tue, 17 Dec 2019 18:13:02 +0000 (-0800) Subject: mon: print FSMap if standbys exist X-Git-Tag: v14.2.8~57^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=4a0f6d72846e03206f1adab5d86008241c62a4b5;p=ceph.git mon: print FSMap if standbys exist Fixes: https://tracker.ceph.com/issues/42088 Signed-off-by: Patrick Donnelly (cherry picked from commit cd6f88d7ebe17edcf657d646d733c207930e4351) --- diff --git a/src/mon/MDSMonitor.h b/src/mon/MDSMonitor.h index 9f415fc24445..1475e312d069 100644 --- a/src/mon/MDSMonitor.h +++ b/src/mon/MDSMonitor.h @@ -49,6 +49,13 @@ class MDSMonitor : public PaxosService, public PaxosFSMap, protected CommandHand bool prepare_update(MonOpRequestRef op) override; bool should_propose(double& delay) override; + bool should_print_status() const { + auto& fs = get_fsmap(); + auto fs_count = fs.filesystem_count(); + auto standby_count = fs.get_num_standby(); + return fs_count > 0 || standby_count > 0; + } + void on_active() override; void on_restart() override; diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index 1549580b973a..03cca3c8c4c3 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -3009,8 +3009,8 @@ void Monitor::get_cluster_status(stringstream &ss, Formatter *f) mgrmon()->get_map().print_summary(nullptr, &ss); ss << "\n"; } - if (mdsmon()->get_fsmap().filesystem_count() > 0) { - ss << " mds: " << spacing << mdsmon()->get_fsmap() << "\n"; + if (mdsmon()->should_print_status()) { + ss << " mds: " << spacing << mdsmon()->get_fsmap() << "\n"; } ss << " osd: " << spacing; osdmon()->osdmap.print_summary(NULL, ss, string(maxlen + 6, ' '));