]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rgw: prevent 'radosgw-admin bucket reshard' if zonegroup reshard is disabled
authorCasey Bodley <cbodley@redhat.com>
Wed, 9 Feb 2022 21:55:38 +0000 (16:55 -0500)
committerCasey Bodley <cbodley@redhat.com>
Fri, 27 May 2022 19:47:33 +0000 (15:47 -0400)
dynamic reshard was gated behind the zonegroup resharding flag with
RGWSI_Zone::can_reshard(), but manual reshard was only calling
RGWBucketReshard::can_reshard()

Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/rgw/rgw_admin.cc

index 690a6b922823e157c3b87b53a2f2decf900c346b..29eb00ac1b439baa40e51c4d800428899d4398f6 100644 (file)
@@ -7730,6 +7730,12 @@ next:
     }
 
     auto zone_svc = static_cast<rgw::sal::RadosStore*>(store)->svc()->zone;
+    if (!zone_svc->can_reshard()) {
+      const auto& zonegroup = zone_svc->get_zonegroup();
+      std::cerr << "The zonegroup '" << zonegroup.get_name() << "' does not "
+          "have the resharding feature enabled." << std::endl;
+      return ENOTSUP;
+    }
     if (!RGWBucketReshard::can_reshard(bucket->get_info(), zone_svc) &&
         !yes_i_really_mean_it) {
       std::cerr << "Bucket '" << bucket->get_name() << "' already has too many "
@@ -7737,7 +7743,7 @@ next:
           "from previous reshards that peer zones haven't finished syncing. "
           "Resharding is not recommended until the old generations sync, but "
           "you can force a reshard with --yes-i-really-mean-it." << std::endl;
-      return -EINVAL;
+      return EINVAL;
     }
 
     RGWBucketReshard br(static_cast<rgw::sal::RadosStore*>(store),