]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
radosgw-admin: fix --tier-config for 'zonegroup add'
authorCasey Bodley <cbodley@redhat.com>
Fri, 2 Sep 2022 17:52:22 +0000 (13:52 -0400)
committerCasey Bodley <cbodley@redhat.com>
Wed, 28 Sep 2022 21:48:00 +0000 (17:48 -0400)
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 <cbodley@redhat.com>
src/rgw/rgw_admin.cc

index 116587d681c1eece7bfc047b83e00373b07e5ced..62e13ac7deb35c3f53f59a9c581df5e3dd37f63b 100644 (file)
@@ -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