]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: ignore zoneless default realm when not configured
authorCasey Bodley <cbodley@redhat.com>
Fri, 23 Aug 2024 19:03:31 +0000 (15:03 -0400)
committerCasey Bodley <cbodley@redhat.com>
Mon, 26 Aug 2024 13:35:48 +0000 (09:35 -0400)
"default" zone/zonegroup deployments without a realm can be broken by
the creation of an unrelated realm, because that realm is (was)
automatically set as the default

when startup detects an incomplete default realm (one that doesn't have
a default zone), fall back to the realmless "default" zone/zonegroup
instead

Fixes: https://tracker.ceph.com/issues/67697
Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/rgw/driver/rados/rgw_zone.cc

index ae7a4d48e5e6b10ab5f5a7b38cd68aabe9ef3081..f9de570aa5445c31098d5a59e8ba2fafd31e11e5 100644 (file)
@@ -1199,6 +1199,18 @@ int SiteConfig::load(const DoutPrefixProvider* dpp, optional_yield y,
   } else if (realm) {
     // load the realm's default zone
     r = cfgstore->read_default_zone(dpp, y, realm->id, zone_params, nullptr);
+    if (r == -ENOENT) {
+      if (realm_name.empty()) {
+        // rgw_realm was not specified, and we found a default realm that
+        // doesn't have a default zone. ignore the realm and try to load the
+        // global default zone
+        realm = std::nullopt;
+        r = read_or_create_default_zone(dpp, y, cfgstore, zone_params);
+      } else {
+        ldpp_dout(dpp, 0) << "No rgw_zone configured, and the selected realm \""
+            << realm->name << "\" does not have a default zone." << dendl;
+      }
+    }
   } else {
     // load or create the "default" zone
     r = read_or_create_default_zone(dpp, y, cfgstore, zone_params);