From: Casey Bodley Date: Fri, 2 Sep 2022 17:52:22 +0000 (-0400) Subject: radosgw-admin: fix --tier-config for 'zonegroup add' X-Git-Tag: v18.1.0~1101^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=547f07d249b1847384b30a33d912f9ca5a01aba3;p=ceph.git radosgw-admin: fix --tier-config for 'zonegroup add' ZONEGROUP_ADD applies changes to RGWZoneParams based on the --tier-config option, but doesn't write those changes to rados Signed-off-by: Casey Bodley --- diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc index 116587d681c1..62e13ac7deb3 100644 --- a/src/rgw/rgw_admin.cc +++ b/src/rgw/rgw_admin.cc @@ -5133,8 +5133,24 @@ int main(int argc, const char **argv) cerr << "unable to initialize zone: " << cpp_strerror(-ret) << std::endl; return -ret; } + + bool need_zone_update = false; + if (zone.realm_id != zonegroup.realm_id) { zone.realm_id = zonegroup.realm_id; + need_zone_update = true; + } + + for (auto a : tier_config_add) { + ret = zone.tier_config.set(a.first, a.second); + if (ret < 0) { + cerr << "ERROR: failed to set configurable: " << a << std::endl; + return EINVAL; + } + need_zone_update = true; + } + + if (need_zone_update) { ret = zone.update(dpp(), null_yield); if (ret < 0) { cerr << "failed to save zone info: " << cpp_strerror(-ret) << std::endl; @@ -5144,14 +5160,6 @@ int main(int argc, const char **argv) string *ptier_type = (tier_type_specified ? &tier_type : nullptr); - for (auto a : tier_config_add) { - int r = zone.tier_config.set(a.first, a.second); - if (r < 0) { - cerr << "ERROR: failed to set configurable: " << a << std::endl; - return EINVAL; - } - } - bool *psync_from_all = (sync_from_all_specified ? &sync_from_all : nullptr); string *predirect_zone = (redirect_zone_set ? &redirect_zone : nullptr); if (enable_features.empty()) { // enable all features by default