]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: Read `sync status` from only the zones allowed to sync from 52445/head
authorSoumya Koduri <skoduri@redhat.com>
Wed, 5 Jul 2023 12:15:39 +0000 (17:45 +0530)
committerSoumya Koduri <skoduri@redhat.com>
Sun, 23 Jul 2023 14:21:07 +0000 (19:51 +0530)
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 <skoduri@redhat.com>
src/rgw/rgw_admin.cc
src/rgw/services/svc_zone.cc
src/rgw/services/svc_zone.h

index 210d56f719e8479a147b44873e4293ff9d1f2841..6bbf8cb0e1718aeded1dd214c63d1408f7c4f854 100644 (file)
@@ -2255,7 +2255,7 @@ static void get_data_sync_status(const rgw_zone_id& source_zone, list<string>& s
     return;
   }
 
-  if (!static_cast<rgw::sal::RadosStore*>(driver)->svc()->zone->zone_syncs_from(static_cast<rgw::sal::RadosStore*>(driver)->svc()->zone->get_zone(), *sz)) {
+  if (!static_cast<rgw::sal::RadosStore*>(driver)->svc()->zone->zone_syncs_from(*sz)) {
     push_ss(ss, status, tab) << string("not syncing from zone");
     flush_ss(ss, status);
     return;
index 3f810d7acd24510ddf008d2e4dbe919115522eeb..180d9371222bf490934d6daed12c7d3ab12cd2ff 100644 (file)
@@ -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,
index 00d4c0f4992e0f3ad37195b7a407770262b59b51..7b0a277c439fd5d6466c8bf7634675e040e18985 100644 (file)
@@ -103,6 +103,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; }