From 75da4375ee0e36c58f96cbf2920c3b9aadf12733 Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Tue, 27 Sep 2016 15:13:37 -0700 Subject: [PATCH] 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 --- src/rgw/rgw_admin.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc index 58600a791b26c..45256bf5ecf1f 100644 --- a/src/rgw/rgw_admin.cc +++ b/src/rgw/rgw_admin.cc @@ -4888,6 +4888,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(); -- 2.39.5