} 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);