]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw_admin: require --yes-i-really-mean-it for bucket reshard
authorYehuda Sadeh <yehuda@redhat.com>
Tue, 27 Sep 2016 22:13:37 +0000 (15:13 -0700)
committerRobin H. Johnson <robin.johnson@dreamhost.com>
Thu, 9 Feb 2017 22:37:02 +0000 (14:37 -0800)
in the case where num shards are less or equal to current bucket

Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
(cherry picked from commit 75da4375ee0e36c58f96cbf2920c3b9aadf12733)
See: http://tracker.ceph.com/issues/17556
See: https://github.com/ceph/ceph/pull/11368
Signed-off-by: Robin H. Johnson <robin.johnson@dreamhost.com>
src/rgw/rgw_admin.cc

index 9fd5988c214493428c1739275056e075e8ab0896..6fc476df05f60db02c1e8542ec547f4e007ba5b9 100644 (file)
@@ -5059,6 +5059,12 @@ next:
 
     int num_source_shards = (bucket_info.num_shards > 0 ? bucket_info.num_shards : 1);
 
+    if (num_shards <= num_source_shards && !yes_i_really_mean_it) {
+      cerr << "num shards is less or equal to current shards count" << std::endl
+           << "do you really mean it? (requires --yes-i-really-mean-it)" << std::endl;
+      return EINVAL;
+    }
+
     RGWBucketInfo new_bucket_info(bucket_info);
     store->create_bucket_id(&new_bucket_info.bucket.bucket_id);
     new_bucket_info.bucket.oid.clear();