]> 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 21:59:37 +0000 (17:59 -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>
(cherry picked from commit 902cc0a71e91faf6d6e3685c036d346251e4f77f)

src/rgw/driver/rados/rgw_zone.cc

index 40f9c451c08e1582d21d339a5b77decda407332c..ace9d70fedd2128c0914b02488cab9230c02d824 100644 (file)
@@ -1205,6 +1205,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);