From: Casey Bodley Date: Wed, 9 Feb 2022 21:55:38 +0000 (-0500) Subject: rgw: prevent 'radosgw-admin bucket reshard' if zonegroup reshard is disabled X-Git-Tag: v18.0.0~787^2~39 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=85c091588f7b9c3fd2fc9584bafb396150076890;p=ceph.git rgw: prevent 'radosgw-admin bucket reshard' if zonegroup reshard is disabled 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 --- diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc index 690a6b922823..29eb00ac1b43 100644 --- a/src/rgw/rgw_admin.cc +++ b/src/rgw/rgw_admin.cc @@ -7730,6 +7730,12 @@ next: } auto zone_svc = static_cast(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(store),