]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/OSDMonitor: require force flag is swap-bucket alg types differ 15072/head
authorSage Weil <sage@redhat.com>
Mon, 15 May 2017 02:17:12 +0000 (21:17 -0500)
committerSage Weil <sage@redhat.com>
Mon, 15 May 2017 13:15:59 +0000 (09:15 -0400)
Signed-off-by: Sage Weil <sage@redhat.com>
src/mon/OSDMonitor.cc

index 4c61f98b29f6f9c3b603cf5d959b32323f0751a3..d0a2b9df7ecf63d323f9db27bf3ea83b3139a56d 100644 (file)
@@ -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);