]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: don't use g_conf from MDSMap
authorJohn Spray <john.spray@redhat.com>
Thu, 15 Oct 2015 13:23:52 +0000 (14:23 +0100)
committerJohn Spray <john.spray@redhat.com>
Tue, 3 Nov 2015 12:34:25 +0000 (12:34 +0000)
Signed-off-by: John Spray <john.spray@redhat.com>
src/mds/MDSMap.cc
src/mds/MDSMap.h
src/mon/MDSMonitor.cc

index a0f81a4552af80981a6dc27b307717c4f12b3d47..3f1077e6dedf9efde26a250ba63cb1bc6afd1342 100644 (file)
@@ -660,7 +660,8 @@ bool MDSMap::cluster_unavailable() const
     if (up.count(rank) != 0) {
       name = mds_info.at(up.at(rank)).name;
     }
-    const bool standby_avail = find_replacement_for(rank, name) != MDS_GID_NONE;
+    const mds_rank_t replacement = find_replacement_for(rank, name, false);
+    const bool standby_avail = replacement != MDS_GID_NONE;
 
     // If the rank is unfilled, and there are no standbys, we're unavailable
     if (up.count(rank) == 0 && !standby_avail) {
index c35fe3bdbe32998b2b97244dd8574e3a7be3d386..b7b5d341416613147caa8d267d58ec796e08e013 100644 (file)
@@ -429,7 +429,8 @@ public:
     return MDS_GID_NONE;
   }
 
-  mds_gid_t find_unused_for(mds_rank_t mds, std::string& name) const {
+  mds_gid_t find_unused_for(mds_rank_t mds, std::string& name,
+                            bool force_standby_active) const {
     for (std::map<mds_gid_t,mds_info_t>::const_iterator p = mds_info.begin();
          p != mds_info.end();
          ++p) {
@@ -439,19 +440,20 @@ public:
         continue;
       if ((p->second.standby_for_rank == MDS_NO_STANDBY_PREF ||
            p->second.standby_for_rank == MDS_MATCHED_ACTIVE ||
-           (p->second.standby_for_rank == MDS_STANDBY_ANY && g_conf->mon_force_standby_active))) {
+           (p->second.standby_for_rank == MDS_STANDBY_ANY && force_standby_active))) {
         return p->first;
       }
     }
     return MDS_GID_NONE;
   }
 
-  mds_gid_t find_replacement_for(mds_rank_t mds, std::string& name) const {
+  mds_gid_t find_replacement_for(mds_rank_t mds, std::string& name,
+                                 bool force_standby_active) const {
     const mds_gid_t standby = find_standby_for(mds, name);
     if (standby)
       return standby;
     else
-      return find_unused_for(mds, name);
+      return find_unused_for(mds, name, force_standby_active);
   }
 
   void get_health(list<pair<health_status_t,std::string> >& summary,
index 2530628d802216f09e82b0359b4c9d7edb5cffba..664af7b03e752aa87d2a7686db944274e1da75ce 100644 (file)
@@ -1906,7 +1906,8 @@ void MDSMonitor::tick()
     string name;
     while (pending_mdsmap.is_in(mds))
       mds++;
-    mds_gid_t newgid = pending_mdsmap.find_replacement_for(mds, name);
+    mds_gid_t newgid = pending_mdsmap.find_replacement_for(mds, name,
+                         g_conf->mon_force_standby_active);
     if (!newgid)
       break;
 
@@ -1976,7 +1977,8 @@ void MDSMonitor::tick()
       if (info.rank >= 0 &&
          info.state != MDSMap::STATE_STANDBY &&
          info.state != MDSMap::STATE_STANDBY_REPLAY &&
-         (sgid = pending_mdsmap.find_replacement_for(info.rank, info.name)) != MDS_GID_NONE) {
+         (sgid = pending_mdsmap.find_replacement_for(info.rank, info.name, 
+                    g_conf->mon_force_standby_active)) != MDS_GID_NONE) {
        MDSMap::mds_info_t& si = pending_mdsmap.mds_info[sgid];
        dout(10) << " replacing " << gid << " " << info.addr << " mds." << info.rank << "." << info.inc
                 << " " << ceph_mds_state_name(info.state)
@@ -2063,7 +2065,8 @@ void MDSMonitor::tick()
     while (p != failed.end()) {
       mds_rank_t f = *p++;
       string name;  // FIXME
-      mds_gid_t sgid = pending_mdsmap.find_replacement_for(f, name);
+      mds_gid_t sgid = pending_mdsmap.find_replacement_for(f, name,
+          g_conf->mon_force_standby_active);
       if (sgid) {
        MDSMap::mds_info_t& si = pending_mdsmap.mds_info[sgid];
        dout(0) << " taking over failed mds." << f << " with " << sgid << "/" << si.name << " " << si.addr << dendl;