]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: add volumes + status to data: section of 'ceph status'
authorSage Weil <sage@newdream.net>
Fri, 29 Jan 2021 21:41:48 +0000 (16:41 -0500)
committerSage Weil <sage@newdream.net>
Wed, 17 Feb 2021 22:13:27 +0000 (17:13 -0500)
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 <sage@newdream.net>
src/mds/FSMap.cc
src/mds/FSMap.h
src/mds/MDSMap.h
src/mon/MDSMonitor.h
src/mon/Monitor.cc

index 6de16189dcc2d31815c133746c204b442a8e97f3..59cbd93f113fd0040368c274d2a1b47400e00562 100644 (file)
@@ -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) {
index 8fa7e5de67663502cbbdf6d478d4313ff86ebcd8..7355b04ac5255855c29df84b4c6ad4767e7b814b 100644 (file)
@@ -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<FSMap*>& ls);
index b3b8b7c7bff68ba79739db37b79d0f51bb479f11..56344dd96a944663418c39a92cb059861ce3d29d 100644 (file)
@@ -332,6 +332,9 @@ public:
   void get_failed_mds_set(std::set<mds_rank_t>& s) const {
     s = failed;
   }
+  void get_damaged_mds_set(std::set<mds_rank_t>& 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
index 46c8c2df27f4b92d707860923551b2dfc1edd21b..d54434b4975e3fee999458ae0e7cd1f491deff82 100644 (file)
@@ -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<std::string,int> *out);
   void get_versions(std::map<std::string, std::list<std::string>> &versions);
 
index 256ad58a6de197b7fedbe4fccadd2c63bf54eb6c..73afc284279a4ab3a2680e05e2590655c634d450 100644 (file)
@@ -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();