]> 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)
committerYehuda Sadeh <yehuda@redhat.com>
Fri, 30 Sep 2016 17:16:38 +0000 (10:16 -0700)
in the case where num shards are less or equal to current bucket

Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/rgw/rgw_admin.cc

index 1eef84c2ab77787b2dd5559cca18456a53e130f9..e23ac470d18c6da6e3ceff66fa4f7f8ce7050cd6 100644 (file)
@@ -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();