From cd6f88d7ebe17edcf657d646d733c207930e4351 Mon Sep 17 00:00:00 2001 From: Patrick Donnelly Date: Tue, 17 Dec 2019 10:13:02 -0800 Subject: [PATCH] mon: print FSMap if standbys exist Fixes: https://tracker.ceph.com/issues/42088 Signed-off-by: Patrick Donnelly --- src/mon/MDSMonitor.h | 7 +++++++ src/mon/Monitor.cc | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/mon/MDSMonitor.h b/src/mon/MDSMonitor.h index 9f415fc2444..1475e312d06 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 27ea54b0b32..e8f3ab8fe24 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -3005,8 +3005,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, ' ')); -- 2.47.3