]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/MDSMonitor: Add confirmation to "ceph mds setmap"
authorYan, Zheng <zyan@redhat.com>
Mon, 18 Jan 2016 06:37:13 +0000 (14:37 +0800)
committerYan, Zheng <zyan@redhat.com>
Mon, 18 Jan 2016 07:00:35 +0000 (15:00 +0800)
Signed-off-by: Yan, Zheng <zyan@redhat.com>
src/mon/MDSMonitor.cc
src/mon/MonCommands.h

index c0fad8e074897fce8a32c70a5fa23e19051d494f..df27922f439cb99da062054fb749bad79367318b 100644 (file)
@@ -1567,6 +1567,14 @@ int MDSMonitor::filesystem_command(
     }
     r = 0;
   } else if (prefix == "mds setmap") {
+    string confirm;
+    if (!cmd_getval(g_ceph_context, cmdmap, "confirm", confirm) ||
+       confirm != "--yes-i-really-mean-it") {
+      ss << "WARNING: this can make your filesystem inaccessible! "
+           "Add --yes-i-really-mean-it if you are sure you wish to continue.";
+      return -EINVAL;;
+    }
+
     MDSMap map;
     try {
       map.decode(m->get_data());
index 8d09f91fba040b1501270520cb89e04dfc53ac63..a85758a209eab3f49e27f99b9beb786b280d133d 100644 (file)
@@ -326,7 +326,8 @@ COMMAND("mds set " \
        "name=confirm,type=CephString,req=false",                       \
        "set mds parameter <var> to <val>", "mds", "rw", "cli,rest")
 COMMAND("mds setmap " \
-       "name=epoch,type=CephInt,range=0", \
+       "name=epoch,type=CephInt,range=0 " \
+       "name=confirm,type=CephString,req=false",
        "set mds map; must supply correct epoch number", "mds", "rw", "cli,rest")
 // arbitrary limit 0-20 below; worth standing on head to make it
 // relate to actual state definitions?