From: Yehuda Sadeh Date: Tue, 27 Sep 2016 22:13:37 +0000 (-0700) Subject: rgw_admin: require --yes-i-really-mean-it for bucket reshard X-Git-Tag: v0.94.10~8^2~6 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f07e22ae7beab634068cc37a975356393c8b60bf;p=ceph.git rgw_admin: require --yes-i-really-mean-it for bucket reshard in the case where num shards are less or equal to current bucket Signed-off-by: Yehuda Sadeh --- diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc index 1eef84c2ab77..e23ac470d18c 100644 --- a/src/rgw/rgw_admin.cc +++ b/src/rgw/rgw_admin.cc @@ -2701,6 +2701,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();