From: Soumya Koduri Date: Wed, 5 Jul 2023 12:15:39 +0000 (+0530) Subject: rgw: Read `sync status` from only the zones allowed to sync from X-Git-Tag: v17.2.7~115^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ba3267d78928a03dec8eaa6e1f95108a45d8d930;p=ceph.git rgw: Read `sync status` from only the zones allowed to sync from Using multisite sync policy, zones within a zonegroup can be configured not to sync from certain zones. Filter such zones while reading sync status. Fixes: https://tracker.ceph.com/issues/62014 Signed-off-by: Soumya Koduri (cherry picked from commit 094460c26b8fdd9a72667800b54a0cfaa5409c88) Conflicts: src/rgw/rgw_admin.cc (trivial: store vs driver) --- diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc index 24754ee747ff..a27d6666ab22 100644 --- a/src/rgw/rgw_admin.cc +++ b/src/rgw/rgw_admin.cc @@ -2260,7 +2260,7 @@ static void get_data_sync_status(const rgw_zone_id& source_zone, list& s return; } - if (!static_cast(store)->svc()->zone->zone_syncs_from(static_cast(store)->svc()->zone->get_zone(), *sz)) { + if (!static_cast(store)->svc()->zone->zone_syncs_from(*sz)) { push_ss(ss, status, tab) << string("not syncing from zone"); flush_ss(ss, status); return; diff --git a/src/rgw/services/svc_zone.cc b/src/rgw/services/svc_zone.cc index bea9726f3420..56715dc72a20 100644 --- a/src/rgw/services/svc_zone.cc +++ b/src/rgw/services/svc_zone.cc @@ -65,6 +65,21 @@ bool RGWSI_Zone::zone_syncs_from(const RGWZone& target_zone, const RGWZone& sour sync_modules_svc->get_manager()->supports_data_export(source_zone.tier_type); } +bool RGWSI_Zone::zone_syncs_from(const RGWZone& source_zone) const +{ + auto target_zone = get_zone(); + bool found = false; + + for (auto s : data_sync_source_zones) { + if (s->id == source_zone.id) { + found = true; + break; + } + } + return found && target_zone.syncs_from(source_zone.name) && + sync_modules_svc->get_manager()->supports_data_export(source_zone.tier_type); +} + int RGWSI_Zone::search_realm_with_zone(const DoutPrefixProvider *dpp, const rgw_zone_id& zid, RGWRealm *prealm, diff --git a/src/rgw/services/svc_zone.h b/src/rgw/services/svc_zone.h index 175fbc2c4a0e..9526a0344d63 100644 --- a/src/rgw/services/svc_zone.h +++ b/src/rgw/services/svc_zone.h @@ -105,6 +105,7 @@ public: bool zone_is_writeable(); bool zone_syncs_from(const RGWZone& target_zone, const RGWZone& source_zone) const; + bool zone_syncs_from(const RGWZone& source_zone) const; bool get_redirect_zone_endpoint(std::string *endpoint); bool sync_module_supports_writes() const { return writeable_zone; } bool sync_module_exports_data() const { return exports_data; }