From: Sage Weil Date: Mon, 28 Mar 2016 12:57:14 +0000 (-0400) Subject: mon/OSDMonitor: require force flag to use obscure cache modes X-Git-Tag: v10.1.1~59^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=90fe8e3d0b1ded6d14a6a43ecbd6c8634f691fbe;p=ceph.git mon/OSDMonitor: require force flag to use obscure cache modes Only none, writeback, proxy, and readproxy are robust and supported. Require a force flag to use any of the others. Signed-off-by: Sage Weil --- diff --git a/src/mon/MonCommands.h b/src/mon/MonCommands.h index 7a22245b6b2a..80529e433b61 100644 --- a/src/mon/MonCommands.h +++ b/src/mon/MonCommands.h @@ -795,7 +795,8 @@ COMMAND("osd tier rm " \ "osd", "rw", "cli,rest") COMMAND("osd tier cache-mode " \ "name=pool,type=CephPoolname " \ - "name=mode,type=CephChoices,strings=none|writeback|forward|readonly|readforward|proxy|readproxy", \ + "name=mode,type=CephChoices,strings=none|writeback|forward|readonly|readforward|proxy|readproxy " \ + "name=sure,type=CephChoices,strings=--yes-i-really-mean-it,req=false", \ "specify the caching mode for cache tier ", "osd", "rw", "cli,rest") COMMAND("osd tier set-overlay " \ "name=pool,type=CephPoolname " \ diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index dba25a942ff7..0e3db8bc34b6 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -7296,6 +7296,19 @@ done: goto reply; } + string sure; + cmd_getval(g_ceph_context, cmdmap, "sure", sure); + if ((mode != pg_pool_t::CACHEMODE_WRITEBACK && + mode != pg_pool_t::CACHEMODE_NONE && + mode != pg_pool_t::CACHEMODE_PROXY && + mode != pg_pool_t::CACHEMODE_READPROXY) && + sure != "--yes-i-really-mean-it") { + ss << "'" << modestr << "' is not a well-supported cache mode and may " + << "corrupt your data. pass --yes-i-really-mean-it to force."; + err = -EPERM; + goto reply; + } + // pool already has this cache-mode set and there are no pending changes if (p->cache_mode == mode && (pending_inc.new_pools.count(pool_id) == 0 ||