]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: add get_down_mds_set method
authorJohn Spray <john.spray@redhat.com>
Thu, 26 Mar 2015 12:45:45 +0000 (12:45 +0000)
committerJohn Spray <john.spray@redhat.com>
Thu, 26 Mar 2015 13:11:44 +0000 (13:11 +0000)
For places where we would like to treat failed
and damaged MDS ranks the same, like detecting
when someone has dropped offline.

Signed-off-by: John Spray <john.spray@redhat.com>
src/mds/MDSMap.h

index b0818e5d5a08205b9586ce8f0b96a6e9848fe5f3..fa0446f583fe1c4df3132a53723e39cd1df236c0 100644 (file)
@@ -349,6 +349,17 @@ public:
   void get_failed_mds_set(std::set<mds_rank_t>& s) {
     s = failed;
   }
+
+  /**
+   * Get MDS ranks which are in but not up.
+   */
+  void get_down_mds_set(std::set<mds_rank_t> *s)
+  {
+    assert(s != NULL);
+    s->insert(failed.begin(), failed.end());
+    s->insert(damaged.begin(), damaged.end());
+  }
+
   int get_failed() {
     if (!failed.empty()) return *failed.begin();
     return -1;
@@ -551,10 +562,19 @@ public:
     return up.empty();
   }
 
-  // inst
+  /**
+   * Get whether a rank is 'up', i.e. has
+   * an MDS daemon's entity_inst_t associated
+   * with it.
+   */
   bool have_inst(mds_rank_t m) {
     return up.count(m);
   }
+
+  /**
+   * Get the MDS daemon entity_inst_t for a rank
+   * known to be up.
+   */
   const entity_inst_t get_inst(mds_rank_t m) {
     assert(up.count(m));
     return mds_info[up[m]].get_inst();
@@ -563,6 +583,14 @@ public:
     assert(up.count(m));
     return mds_info[up[m]].addr;
   }
+
+  /**
+   * Get the MDS daemon entity_inst_t for a rank,
+   * if it is up.
+   * 
+   * @return true if the rank was up and the inst
+   *         was populated, else false.
+   */
   bool get_inst(mds_rank_t m, entity_inst_t& inst) {
     if (up.count(m)) {
       inst = get_inst(m);