From: Yan, Zheng Date: Mon, 18 Jan 2016 06:37:13 +0000 (+0800) Subject: mon/MDSMonitor: Add confirmation to "ceph mds setmap" X-Git-Tag: v10.0.3~9^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=fc3554e36af439ef1cec0be3d98ca0fabe15ba73;p=ceph.git mon/MDSMonitor: Add confirmation to "ceph mds setmap" Signed-off-by: Yan, Zheng --- diff --git a/src/mon/MDSMonitor.cc b/src/mon/MDSMonitor.cc index c0fad8e07489..df27922f439c 100644 --- a/src/mon/MDSMonitor.cc +++ b/src/mon/MDSMonitor.cc @@ -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()); diff --git a/src/mon/MonCommands.h b/src/mon/MonCommands.h index 8d09f91fba04..a85758a209ea 100644 --- a/src/mon/MonCommands.h +++ b/src/mon/MonCommands.h @@ -326,7 +326,8 @@ COMMAND("mds set " \ "name=confirm,type=CephString,req=false", \ "set mds parameter to ", "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?