]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/MDSMonitor: respect mds_standby_for_rank config 15129/head
authorYan, Zheng <zyan@redhat.com>
Wed, 17 May 2017 08:40:22 +0000 (16:40 +0800)
committerYan, Zheng <zyan@redhat.com>
Wed, 17 May 2017 08:44:30 +0000 (16:44 +0800)
Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
src/mds/FSMap.cc
src/mds/FSMap.h

index 35c8093a380af51bd3c60842e976460ee2288659..5d04bc65fff92feba7e8800b81c166b0256fc5a1 100644 (file)
@@ -669,8 +669,8 @@ mds_gid_t FSMap::find_standby_for(mds_role_t role, const std::string& name) cons
   return result;
 }
 
-mds_gid_t FSMap::find_unused(fs_cluster_id_t fscid,
-                            bool force_standby_active) const {
+mds_gid_t FSMap::find_unused_for(mds_role_t role,
+                                bool force_standby_active) const {
   for (const auto &i : standby_daemons) {
     const auto &gid = i.first;
     const auto &info = i.second;
@@ -680,7 +680,10 @@ mds_gid_t FSMap::find_unused(fs_cluster_id_t fscid,
       continue;
 
     if (info.standby_for_fscid != FS_CLUSTER_ID_NONE &&
-        info.standby_for_fscid != fscid)
+        info.standby_for_fscid != role.fscid)
+      continue;
+    if (info.standby_for_rank != MDS_RANK_NONE &&
+        info.standby_for_rank != role.rank)
       continue;
 
     // To be considered 'unused' a daemon must either not
@@ -699,7 +702,7 @@ mds_gid_t FSMap::find_replacement_for(mds_role_t role, const std::string& name,
   if (standby)
     return standby;
   else
-    return find_unused(role.fscid, force_standby_active);
+    return find_unused_for(role, force_standby_active);
 }
 
 void FSMap::sanity() const
index 881281edca17c88a432211299321f2ceb5241467..3d389c48885b5751a8c99b8d79799c0c79ccf5a1 100644 (file)
@@ -468,7 +468,7 @@ public:
 
   mds_gid_t find_standby_for(mds_role_t mds, const std::string& name) const;
 
-  mds_gid_t find_unused(fs_cluster_id_t fscid, bool force_standby_active) const;
+  mds_gid_t find_unused_for(mds_role_t mds, bool force_standby_active) const;
 
   mds_gid_t find_replacement_for(mds_role_t mds, const std::string& name,
                                  bool force_standby_active) const;