From: Sage Weil Date: Mon, 15 May 2017 02:17:12 +0000 (-0500) Subject: mon/OSDMonitor: require force flag is swap-bucket alg types differ X-Git-Tag: v12.1.0~10^2~103^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F15072%2Fhead;p=ceph.git mon/OSDMonitor: require force flag is swap-bucket alg types differ Signed-off-by: Sage Weil --- diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index 4c61f98b29f..d0a2b9df7ec 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -6711,6 +6711,14 @@ bool OSDMonitor::prepare_command_impl(MonOpRequestRef op, err = -EPERM; goto reply; } + if (newcrush.get_bucket_alg(sid) != newcrush.get_bucket_alg(did) && + force != "--yes-i-really-mean-it") { + ss << "source bucket alg " << crush_alg_name(newcrush.get_bucket_alg(sid)) << " != " + << "dest bucket alg " << crush_alg_name(newcrush.get_bucket_alg(did)) + << "; pass --yes-i-really-mean-it to proceed anyway"; + err = -EPERM; + goto reply; + } int r = newcrush.swap_bucket(g_ceph_context, sid, did); if (r < 0) { ss << "failed to swap bucket contents: " << cpp_strerror(r);