]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/MDSMonitor: fix `mds fail` for standby MDSs 3310/head
authorJohn Spray <john.spray@redhat.com>
Wed, 7 Jan 2015 12:37:40 +0000 (12:37 +0000)
committerJohn Spray <john.spray@redhat.com>
Wed, 7 Jan 2015 14:13:12 +0000 (14:13 +0000)
This command takes a gid, rank or name, but
in the name case it would previously only work if
the named daemon had a rank assigned (mds_info->rank >= 0),
otherwise it would fail silently.

Signed-off-by: John Spray <john.spray@redhat.com>
src/mon/MDSMonitor.cc

index 25b22505531d10daa52fbf9112fd2bbaeee2a5e0..399dd2e387006989d9a4a23fc3786ea90f279ead 100644 (file)
@@ -877,7 +877,15 @@ int MDSMonitor::fail_mds(std::ostream &ss, const std::string &arg)
       ss << "Can't find any MDS named '" << arg << "'";
       return -ENOENT;
     }
-    rank_or_gid = (unsigned long long)(mds_info->rank);
+    if (mds_info->rank >= 0) {
+      dout(10) << __func__ << ": resolved MDS name '" << arg << "' to rank " << rank_or_gid << dendl;
+      rank_or_gid = (unsigned long long)(mds_info->rank);
+    } else {
+      dout(10) << __func__ << ": resolved MDS name '" << arg << "' to GID " << rank_or_gid << dendl;
+      rank_or_gid = mds_info->global_id;
+    }
+  } else {
+    dout(10) << __func__ << ": treating MDS reference '" << arg << "' as an integer " << rank_or_gid << dendl;
   }
 
   if (!mon->osdmon()->is_writeable()) {
@@ -886,6 +894,7 @@ int MDSMonitor::fail_mds(std::ostream &ss, const std::string &arg)
 
   bool failed_mds_gid = false;
   if (pending_mdsmap.up.count(mds_rank_t(rank_or_gid))) {
+    dout(10) << __func__ << ": validated rank/GID " << rank_or_gid << " as a rank" << dendl;
     mds_gid_t gid = pending_mdsmap.up[mds_rank_t(rank_or_gid)];
     if (pending_mdsmap.mds_info.count(gid)) {
       fail_mds_gid(gid);
@@ -893,9 +902,12 @@ int MDSMonitor::fail_mds(std::ostream &ss, const std::string &arg)
     }
     ss << "failed mds." << rank_or_gid;
   } else if (pending_mdsmap.mds_info.count(mds_gid_t(rank_or_gid))) {
+    dout(10) << __func__ << ": validated rank/GID " << rank_or_gid << " as a GID" << dendl;
     fail_mds_gid(mds_gid_t(rank_or_gid));
     failed_mds_gid = true;
     ss << "failed mds gid " << rank_or_gid;
+  } else {
+    dout(1) << __func__ << ": rank/GID " << rank_or_gid << " not a existent rank or GID" << dendl;
   }
 
   if (failed_mds_gid) {