From: Sage Weil Date: Fri, 29 Jan 2021 21:41:48 +0000 (-0500) Subject: mds: add volumes + status to data: section of 'ceph status' X-Git-Tag: v17.1.0~2849^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=60ebc9b04e1baae080fc5680b2a1a469f87d93b5;p=ceph.git mds: add volumes + status to data: section of 'ceph status' This expands the data: section to include volume count and high-level status, expanding the view of "logical" data services: data: volumes: 0/1 file systems healthy, 1 degraded pools: 3 pools, 65 pgs objects: 22 objects, 2.3 KiB usage: 1.0 GiB used, 100 GiB / 101 GiB avail pgs: 65 active+clean or data: volumes: 1/1 file systems healthy pools: 3 pools, 65 pgs objects: 22 objects, 2.3 KiB usage: 1.0 GiB used, 100 GiB / 101 GiB avail pgs: 65 active+clean Signed-off-by: Sage Weil --- diff --git a/src/mds/FSMap.cc b/src/mds/FSMap.cc index 6de16189dcc2..59cbd93f113f 100644 --- a/src/mds/FSMap.cc +++ b/src/mds/FSMap.cc @@ -224,6 +224,43 @@ void FSMap::print(ostream& out) const } } +void FSMap::print_fs_summary(ostream& out) const +{ + if (!filesystems.empty()) { + int num_failed = 0, num_recovering = 0, num_stopped = 0, num_healthy = 0; + int num_damaged = 0; + for (auto& [fscid, fs] : filesystems) { + if (fs->mds_map.is_any_damaged()) { + ++num_damaged; + } + if (fs->mds_map.is_any_failed()) { + ++num_failed; + } else if (fs->mds_map.is_degraded()) { + ++num_recovering; + } else if (fs->mds_map.get_max_mds() == 0) { + ++num_stopped; + } else { + ++num_healthy; + } + } + out << " volumes: " + << num_healthy << "/" << filesystems.size() << " healthy"; + if (num_recovering) { + out << ", " << num_recovering << " recovering"; + } + if (num_failed) { + out << ", " << num_failed << " failed"; + } + if (num_stopped) { + out << ", " << num_stopped << " stopped"; + } + if (num_damaged) { + out << "; " << num_damaged << " damaged"; + } + out << "\n"; + } +} + void FSMap::print_summary(Formatter *f, ostream *out) const { if (f) { diff --git a/src/mds/FSMap.h b/src/mds/FSMap.h index 8fa7e5de6766..7355b04ac525 100644 --- a/src/mds/FSMap.h +++ b/src/mds/FSMap.h @@ -567,6 +567,7 @@ public: void print(std::ostream& out) const; void print_summary(ceph::Formatter *f, std::ostream *out) const; + void print_fs_summary(std::ostream& out) const; void dump(ceph::Formatter *f) const; static void generate_test_instances(std::list& ls); diff --git a/src/mds/MDSMap.h b/src/mds/MDSMap.h index b3b8b7c7bff6..56344dd96a94 100644 --- a/src/mds/MDSMap.h +++ b/src/mds/MDSMap.h @@ -332,6 +332,9 @@ public: void get_failed_mds_set(std::set& s) const { s = failed; } + void get_damaged_mds_set(std::set& s) const { + s = damaged; + } // features uint64_t get_up_features(); @@ -473,7 +476,10 @@ public: // recovery_set. bool is_degraded() const; bool is_any_failed() const { - return failed.size(); + return !failed.empty(); + } + bool is_any_damaged() const { + return !damaged.empty(); } bool is_resolving() const { return diff --git a/src/mon/MDSMonitor.h b/src/mon/MDSMonitor.h index 46c8c2df27f4..d54434b4975e 100644 --- a/src/mon/MDSMonitor.h +++ b/src/mon/MDSMonitor.h @@ -127,6 +127,9 @@ class MDSMonitor : public PaxosService, public PaxosFSMap, protected CommandHand void count_metadata(const std::string& field, ceph::Formatter *f); public: + void print_fs_summary(ostream& out) { + get_fsmap().print_fs_summary(out); + } void count_metadata(const std::string& field, std::map *out); void get_versions(std::map> &versions); diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index 256ad58a6de1..73afc284279a 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -3083,6 +3083,7 @@ void Monitor::get_cluster_status(stringstream &ss, Formatter *f, } ss << "\n \n data:\n"; + mdsmon()->print_fs_summary(ss); mgrstatmon()->print_summary(NULL, &ss); auto& pem = mgrstatmon()->get_progress_events();