]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/MgrMonitor: make 'mgr fail' work with no arguments 33997/head
authorSage Weil <sage@redhat.com>
Tue, 17 Mar 2020 02:05:21 +0000 (21:05 -0500)
committerSage Weil <sage@redhat.com>
Tue, 17 Mar 2020 02:05:21 +0000 (21:05 -0500)
Fail the active mgr so you don't have to check ceph -s and cut&paste it or
do some jq shenanigans with 'mgr dump'.

Signed-off-by: Sage Weil <sage@redhat.com>
src/mon/MgrMonitor.cc

index 397c3700c21d7dba08ee166b9d8b387530b9fda0..ef126edd65222ad61a99ae16b2739351ab3cf207 100644 (file)
@@ -1051,7 +1051,13 @@ bool MgrMonitor::prepare_command(MonOpRequestRef op)
 
   if (prefix == "mgr fail") {
     string who;
-    cmd_getval(cmdmap, "who", who);
+    if (!cmd_getval(cmdmap, "who", who)) {
+      if (!map.active_gid) {
+       ss << "Currently no active mgr";
+       goto out;
+      }
+      who = map.active_name;
+    }
 
     std::string err;
     uint64_t gid = strict_strtol(who.c_str(), 10, &err);