]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: RGWPubSub requires SiteConfig
authorCasey Bodley <cbodley@redhat.com>
Sun, 4 Feb 2024 20:17:47 +0000 (15:17 -0500)
committerCasey Bodley <cbodley@redhat.com>
Tue, 5 Mar 2024 17:55:25 +0000 (12:55 -0500)
RGWPubSub constructor takes SiteConfig instead of zonegroup map

replace do_all_zonegroups_support_notification_v2() with a generic
function rgw::all_zonegroups_support() that handles non-realm
configurations too

remove unused sal::ZoneGroup::supports_feature()

Signed-off-by: Casey Bodley <cbodley@redhat.com>
17 files changed:
src/rgw/driver/daos/rgw_sal_daos.h
src/rgw/driver/motr/rgw_sal_motr.h
src/rgw/driver/rados/rgw_cr_rados.cc
src/rgw/driver/rados/rgw_notify.cc
src/rgw/driver/rados/rgw_notify.h
src/rgw/driver/rados/rgw_rados.cc
src/rgw/driver/rados/rgw_sal_rados.cc
src/rgw/driver/rados/rgw_sal_rados.h
src/rgw/driver/rados/rgw_zone.cc
src/rgw/driver/rados/rgw_zone.h
src/rgw/rgw_admin.cc
src/rgw/rgw_pubsub.cc
src/rgw/rgw_pubsub.h
src/rgw/rgw_rest_pubsub.cc
src/rgw/rgw_sal.h
src/rgw/rgw_sal_dbstore.h
src/rgw/rgw_sal_filter.h

index 479f5b84a5e30e250c6c8cb6bb16bfc9e9fda53a..c5cfefc222d101a029a0ab608ccfba189737385a 100644 (file)
@@ -430,9 +430,6 @@ class DaosZoneGroup : public StoreZoneGroup {
     return std::make_unique<DaosZoneGroup>(store, group);
   }
   const RGWZoneGroup& get_group() { return group; }
-  virtual bool supports_feature(std::string_view feature) const override {
-    return group.supports(feature);
-  }
 };
 
 class DaosZone : public StoreZone {
index 9ff14a58307dcefad2b5e065c2f213a30f902129..3cc3b37fa9ad0e4073a172540dc30727efc93f3f 100644 (file)
@@ -474,9 +474,6 @@ public:
   virtual std::unique_ptr<ZoneGroup> clone() override {
     return std::make_unique<MotrZoneGroup>(store, group);
   }
-  virtual bool supports_feature(std::string_view feature) const override {
-    return group.supports(feature);
-  }
   friend class MotrZone;
 };
 
index b7d362423e53bd796b3c726f284b321c2c56c13c..fb5722528c3982ffc80eec7073c2d4d21a6de9b3 100644 (file)
@@ -809,7 +809,7 @@ int RGWAsyncFetchRemoteObj::_send_request(const DoutPrefixProvider *dpp)
                   req_id, null_yield);
 
         auto notify_res = static_cast<rgw::sal::RadosNotification*>(notify.get())->get_reservation();
-        int ret = rgw::notify::publish_reserve(dpp, rgw::notify::ObjectSyncedCreate, notify_res, &obj_tags);
+        int ret = rgw::notify::publish_reserve(dpp, *store->svc()->site, rgw::notify::ObjectSyncedCreate, notify_res, &obj_tags);
         if (ret < 0) {
           ldpp_dout(dpp, 1) << "ERROR: reserving notification failed, with error: " << ret << dendl;
           // no need to return, the sync already happened
index e3ee61ba9df0d95c876dea119ef8ff3853b63a0e..a1290ec9b20ae9f83835845115489ac3b6ff0719 100644 (file)
@@ -121,6 +121,7 @@ class Manager : public DoutPrefixProvider {
   const uint32_t stale_reservations_period_s;
   const uint32_t reservations_cleanup_period_s;
   queues_persistency_tracker topics_persistency_tracker;
+  const SiteConfig& site;
 public:
   rgw::sal::RadosStore& rados_store;
 
@@ -491,7 +492,7 @@ private:
           std::string tenant_name;
           // TODO: extract tenant name from queue_name once it is fixed
           uint64_t size_to_migrate = 0;
-          RGWPubSub ps(&rados_store, tenant_name);
+          RGWPubSub ps(&rados_store, tenant_name, site);
 
           rgw_pubsub_topic topic;
           auto ret_of_get_topic = ps.get_topic(this, queue_name, topic,
@@ -669,7 +670,8 @@ public:
   Manager(CephContext* _cct, uint32_t _max_queue_size, uint32_t _queues_update_period_ms, 
           uint32_t _queues_update_retry_ms, uint32_t _queue_idle_sleep_us, u_int32_t failover_time_ms, 
           uint32_t _stale_reservations_period_s, uint32_t _reservations_cleanup_period_s,
-          uint32_t _worker_count, rgw::sal::RadosStore* store) :
+          uint32_t _worker_count, rgw::sal::RadosStore* store,
+          const SiteConfig& site) :
     max_queue_size(_max_queue_size),
     queues_update_period_ms(_queues_update_period_ms),
     queues_update_retry_ms(_queues_update_retry_ms),
@@ -681,6 +683,7 @@ public:
     worker_count(_worker_count),
     stale_reservations_period_s(_stale_reservations_period_s),
     reservations_cleanup_period_s(_reservations_cleanup_period_s),
+    site(site),
     rados_store(*store)
     {
       spawn::spawn(io_context, [this](spawn::yield_context yield) {
@@ -753,7 +756,8 @@ constexpr uint32_t WORKER_COUNT = 1;                 // 1 worker thread
 constexpr uint32_t STALE_RESERVATIONS_PERIOD_S = 120;   // cleanup reservations that are more than 2 minutes old
 constexpr uint32_t RESERVATIONS_CLEANUP_PERIOD_S = 30; // reservation cleanup every 30 seconds
 
-bool init(CephContext* cct, rgw::sal::RadosStore* store, const DoutPrefixProvider *dpp) {
+bool init(CephContext* cct, rgw::sal::RadosStore* store,
+          const SiteConfig& site, const DoutPrefixProvider *dpp) {
   if (s_manager) {
     return false;
   }
@@ -763,7 +767,7 @@ bool init(CephContext* cct, rgw::sal::RadosStore* store, const DoutPrefixProvide
       IDLE_TIMEOUT_USEC, FAILOVER_TIME_MSEC, 
       STALE_RESERVATIONS_PERIOD_S, RESERVATIONS_CLEANUP_PERIOD_S,
       WORKER_COUNT,
-      store);
+      store, site);
   return true;
 }
 
@@ -978,13 +982,13 @@ static inline bool notification_match(reservation_t& res,
 }
 
   int publish_reserve(const DoutPrefixProvider* dpp,
+                     const SiteConfig& site,
                      EventType event_type,
                      reservation_t& res,
                      const RGWObjTags* req_tags)
 {
   rgw_pubsub_bucket_topics bucket_topics;
-  if (do_all_zonegroups_support_notification_v2(
-          res.store->svc()->zone->get_current_period().get_map().zonegroups)) {
+  if (all_zonegroups_support(site, zone_features::notification_v2)) {
     auto ret = 0;
     if (!res.s) {
       //  for non S3-request caller (e.g., lifecycle, ObjectSync), bucket attrs
@@ -1004,7 +1008,7 @@ static inline bool notification_match(reservation_t& res,
       return ret;
     }
   } else {
-    const RGWPubSub ps(res.store, res.user_tenant);
+    const RGWPubSub ps(res.store, res.user_tenant, site);
     const RGWPubSub::Bucket ps_bucket(ps, res.bucket);
     auto rc = ps_bucket.get_topics(res.dpp, bucket_topics, res.yield);
     if (rc < 0) {
@@ -1054,9 +1058,7 @@ static inline bool notification_match(reservation_t& res,
     // load the topic,if there is change in topic config while it's stored in
     // notification.
     rgw_pubsub_topic result;
-    const RGWPubSub ps(
-        res.store, res.user_tenant,
-        &res.store->svc()->zone->get_current_period().get_map().zonegroups);
+    const RGWPubSub ps(res.store, res.user_tenant, site);
     auto ret = ps.get_topic(res.dpp, topic_cfg.name, result, res.yield, nullptr);
     if (ret < 0) {
       ldpp_dout(res.dpp, 1)
index 5117f9eecd8ff63eb8c232e8bcca366260d0c478..4f2f57341ecb22824e6f5d8f533c2db9cfae8767 100644 (file)
@@ -12,6 +12,7 @@
 #include "rgw_pubsub.h"
 
 // forward declarations
+namespace rgw { class SiteConfig; }
 namespace rgw::sal {
     class RadosStore;
     class RGWObject;
@@ -25,7 +26,8 @@ namespace rgw::notify {
 // initialize the notification manager
 // notification manager is dequeuing the 2-phase-commit queues
 // and send the notifications to the endpoints
-bool init(CephContext* cct, rgw::sal::RadosStore* store, const DoutPrefixProvider *dpp);
+bool init(CephContext* cct, rgw::sal::RadosStore* store,
+          const rgw::SiteConfig& site, const DoutPrefixProvider *dpp);
 
 // shutdown the notification manager
 void shutdown();
@@ -110,6 +112,7 @@ struct rgw_topic_stats {
 
 // create a reservation on the 2-phase-commit queue
 int publish_reserve(const DoutPrefixProvider *dpp,
+                     const SiteConfig& site,
                      EventType event_type,
                      reservation_t& reservation,
                      const RGWObjTags* req_tags);
index 18ff24f21813b977cd219494b73ae60ba80f9162..6084c21ef8ea90029c314c2e937fcf2509127749 100644 (file)
@@ -1357,7 +1357,7 @@ int RGWRados::init_complete(const DoutPrefixProvider *dpp, optional_yield y)
   index_completion_manager = new RGWIndexCompletionManager(this);
 
   if (run_notification_thread) {
-    ret = rgw::notify::init(cct, driver, dpp);
+    ret = rgw::notify::init(cct, driver, *svc.site, dpp);
     if (ret < 0 ) {
       ldpp_dout(dpp, 1) << "ERROR: failed to initialize notification manager" << dendl;
     }
index 6e4d346120e2bd9a580b1d40611fb8ce8803c7b4..6aba08828b7259313f373174623b2c23bfe609ca 100644 (file)
@@ -367,7 +367,7 @@ int RadosBucket::remove(const DoutPrefixProvider* dpp,
 
   // if bucket has notification definitions associated with it
   // they should be removed (note that any pending notifications on the bucket are still going to be sent)
-  const RGWPubSub ps(store, info.owner.tenant);
+  const RGWPubSub ps(store, info.owner.tenant, *store->svc()->site);
   const RGWPubSub::Bucket ps_bucket(ps, this);
   const auto ps_ret = ps_bucket.remove_notifications(dpp, y);
   if (ps_ret < 0 && ps_ret != -ENOENT) {
@@ -3061,7 +3061,7 @@ std::unique_ptr<LCSerializer> RadosLifecycle::get_serializer(const std::string&
 
 int RadosNotification::publish_reserve(const DoutPrefixProvider *dpp, RGWObjTags* obj_tags)
 {
-  return rgw::notify::publish_reserve(dpp, event_type, res, obj_tags);
+  return rgw::notify::publish_reserve(dpp, *store->svc()->site, event_type, res, obj_tags);
 }
 
 int RadosNotification::publish_commit(const DoutPrefixProvider* dpp, uint64_t size,
index e85b3fde1d4fc8b781f1377b65cb01b70a11deb6..e15c754d1b491e73cf30d02560f6372a2bd2cd75 100644 (file)
@@ -85,9 +85,6 @@ public:
   virtual std::unique_ptr<ZoneGroup> clone() override {
     return std::make_unique<RadosZoneGroup>(store, group);
   }
-  virtual bool supports_feature(std::string_view feature) const override {
-    return group.supports(feature);
-  }
   const RGWZoneGroup& get_group() const { return group; }
 };
 
index b93f319ac1760541426b074f5c7c83d7e220494a..2c504712381c52785e3018c3e78f6641d2a70e3f 100644 (file)
@@ -1117,6 +1117,19 @@ auto find_zone_placement(const DoutPrefixProvider* dpp,
   return &i->second;
 }
 
+bool all_zonegroups_support(const SiteConfig& site, std::string_view feature)
+{
+  const auto& period = site.get_period();
+  if (!period) {
+    // if we're not in a realm, just check the local zonegroup
+    return site.get_zonegroup().supports(feature);
+  }
+  const auto& zgs = period->period_map.zonegroups;
+  return std::all_of(zgs.begin(), zgs.end(), [feature] (const auto& pair) {
+      return pair.second.supports(feature);
+    });
+}
+
 static int read_or_create_default_zone(const DoutPrefixProvider* dpp,
                                        optional_yield y,
                                        sal::ConfigStore* cfgstore,
index 2eb3e725253fa7f342db1a04c8507815312cfdc3..345cbc6a217164d6f167609ae9c6705ae8228793 100644 (file)
@@ -1009,4 +1009,7 @@ class SiteConfig {
 };
 
 
+/// Test whether all zonegroups in the realm support the given zone feature.
+bool all_zonegroups_support(const SiteConfig& site, std::string_view feature);
+
 } // namespace rgw
index be91c66e9ff870d49c28f6fdc7277aa7249fe178..395e05ce517e01d1dfd4a3f06647754c240417aa 100644 (file)
@@ -10628,8 +10628,7 @@ next:
       cerr << "ERROR: could not init bucket: " << cpp_strerror(-ret) << std::endl;
       return -ret;
     }
-    if (driver->get_zone()->get_zonegroup().supports_feature(
-            rgw::zone_features::notification_v2)) {
+    if (rgw::all_zonegroups_support(*site, rgw::zone_features::notification_v2)) {
       ret = get_bucket_notifications(dpp(), bucket.get(), result);
       if (ret < 0) {
         cerr << "ERROR: could not get topics: " << cpp_strerror(-ret)
@@ -10637,7 +10636,7 @@ next:
         return -ret;
       }
     } else {
-      RGWPubSub ps(driver, tenant);
+      RGWPubSub ps(driver, tenant, *site);
       const RGWPubSub::Bucket b(ps, bucket.get());
       ret = b.get_topics(dpp(), result, null_yield);
       if (ret < 0 && ret != -ENOENT) {
@@ -10650,7 +10649,7 @@ next:
   }
 
   if (opt_cmd == OPT::PUBSUB_TOPIC_LIST) {
-    RGWPubSub ps(driver, tenant, &site->get_period()->get_map().zonegroups);
+    RGWPubSub ps(driver, tenant, *site);
     rgw_pubsub_topics result;
     ret = ps.get_topics(dpp(), result, null_yield);
     if (ret < 0 && ret != -ENOENT) {
@@ -10667,8 +10666,7 @@ next:
         }
       }
     }
-    if (driver->get_zone()->get_zonegroup().supports_feature(
-            rgw::zone_features::notification_v2)) {
+    if (rgw::all_zonegroups_support(*site, rgw::zone_features::notification_v2)) {
       Formatter::ObjectSection top_section(*formatter, "result");
       Formatter::ArraySection s(*formatter, "topics");
       for (const auto& [_, topic] : result.topics) {
@@ -10693,7 +10691,7 @@ next:
       cerr << "ERROR: topic name was not provided (via --topic)" << std::endl;
       return EINVAL;
     }
-    RGWPubSub ps(driver, tenant, &site->get_period()->get_map().zonegroups);
+    RGWPubSub ps(driver, tenant, *site);
 
     rgw_pubsub_topic topic;
     std::set<std::string> subscribed_buckets;
@@ -10703,8 +10701,7 @@ next:
       cerr << "ERROR: could not get topic: " << cpp_strerror(-ret) << std::endl;
       return -ret;
     }
-    if (driver->get_zone()->get_zonegroup().supports_feature(
-            rgw::zone_features::notification_v2)) {
+    if (rgw::all_zonegroups_support(*site, rgw::zone_features::notification_v2)) {
       show_topics_info_v2(topic, subscribed_buckets, formatter.get());
     } else {
       encode_json("topic", topic, formatter.get());
@@ -10728,8 +10725,7 @@ next:
       return -ret;
     }
     rgw_pubsub_bucket_topics bucket_topics;
-    if (driver->get_zone()->get_zonegroup().supports_feature(
-            rgw::zone_features::notification_v2)) {
+    if (rgw::all_zonegroups_support(*site, rgw::zone_features::notification_v2)) {
       ret = get_bucket_notifications(dpp(), bucket.get(), bucket_topics);
       if (ret < 0) {
         cerr << "ERROR: could not get bucket notifications: "
@@ -10737,7 +10733,7 @@ next:
         return -ret;
       }
     } else {
-      RGWPubSub ps(driver, tenant);
+      RGWPubSub ps(driver, tenant, *site);
       const RGWPubSub::Bucket b(ps, bucket.get());
       ret = b.get_topics(dpp(), bucket_topics, null_yield);
       if (ret < 0 && ret != -ENOENT) {
@@ -10770,7 +10766,7 @@ next:
       return -ret;
     }
 
-    RGWPubSub ps(driver, tenant, &site->get_period()->get_map().zonegroups);
+    RGWPubSub ps(driver, tenant, *site);
 
     ret = ps.remove_topic(dpp(), topic_name, null_yield);
     if (ret < 0) {
@@ -10794,12 +10790,11 @@ next:
       return -ret;
     }
 
-    if (driver->get_zone()->get_zonegroup().supports_feature(
-            rgw::zone_features::notification_v2)) {
+    if (rgw::all_zonegroups_support(*site, rgw::zone_features::notification_v2)) {
       ret = remove_notification_v2(dpp(), driver, bucket.get(), notification_id,
                                    null_yield);
     } else {
-      RGWPubSub ps(driver, tenant);
+      RGWPubSub ps(driver, tenant, *site);
 
       rgw_pubsub_bucket_topics bucket_topics;
       const RGWPubSub::Bucket b(ps, bucket.get());
index dec38ee87e878b3f92d6044f82475a0494eef116..f4ddb118cd31eed6f6287ff061a3809a76fc12c2 100644 (file)
@@ -504,9 +504,10 @@ RGWPubSub::RGWPubSub(rgw::sal::Driver* _driver, const std::string& _tenant)
 
 RGWPubSub::RGWPubSub(rgw::sal::Driver* _driver,
                      const std::string& _tenant,
-                     const std::map<std::string, RGWZoneGroup>* _zonegroups)
-    : driver(_driver), tenant(_tenant), zonegroups(_zonegroups) {
-  use_notification_v2 = do_all_zonegroups_support_notification_v2(*zonegroups);
+                     const rgw::SiteConfig& site)
+    : driver(_driver), tenant(_tenant),
+      use_notification_v2(rgw::all_zonegroups_support(site, rgw::zone_features::notification_v2))
+{
 }
 
 int RGWPubSub::read_topics(const DoutPrefixProvider *dpp, rgw_pubsub_topics& result,
@@ -651,16 +652,6 @@ int get_bucket_notifications(const DoutPrefixProvider* dpp,
   return 0;
 }
 
-bool do_all_zonegroups_support_notification_v2(
-    std::map<std::string, RGWZoneGroup> zonegroups) {
-  for (const auto& [_, zonegroup] : zonegroups) {
-    if (!zonegroup.supports(rgw::zone_features::notification_v2)) {
-      return false;
-    }
-  }
-  return true;
-}
-
 std::string topic_to_unique(const std::string& topic,
                             const std::string& notification) {
   return notification + "_" + topic;
index 8509d86e2255b4f739ebe83518e310120dfd73e5..ed7856721756c6545e457fd893332a8097460dbf 100644 (file)
@@ -560,7 +560,6 @@ class RGWPubSub
 
   rgw::sal::Driver* const driver;
   const std::string tenant;
-  const std::map<std::string, RGWZoneGroup>* zonegroups = nullptr;
   bool use_notification_v2 = false;
 
   int read_topics(const DoutPrefixProvider *dpp, rgw_pubsub_topics& result, 
@@ -573,7 +572,7 @@ public:
 
  RGWPubSub(rgw::sal::Driver* _driver,
            const std::string& _tenant,
-           const std::map<std::string, RGWZoneGroup>* zonegroups);
+           const rgw::SiteConfig& site);
 
   class Bucket {
     friend class RGWPubSub;
@@ -670,9 +669,6 @@ namespace rgw::notify {
   constexpr static const std::string_view DEFAULT_CONFIG{"None"};
 }
 
-bool do_all_zonegroups_support_notification_v2(
-    std::map<std::string, RGWZoneGroup> zonegroups);
-
 std::string topic_to_unique(const std::string& topic,
                             const std::string& notification);
 
index 38943736e4514b6bbdc0598818ae5011abf11946..c64b5785337254b03d7fa138a413fb684a2f2288 100644 (file)
@@ -197,8 +197,7 @@ class RGWPSCreateTopicOp : public RGWOp {
       return ret;
     }
 
-    const RGWPubSub ps(driver, s->owner.id.tenant,
-                       &s->penv.site->get_period()->get_map().zonegroups);
+    const RGWPubSub ps(driver, s->owner.id.tenant, *s->penv.site);
     rgw_pubsub_topic result;
     ret = ps.get_topic(this, topic_name, result, y, nullptr);
     if (ret == -ENOENT) {
@@ -278,8 +277,7 @@ void RGWPSCreateTopicOp::execute(optional_yield y) {
       return;
     }
   }
-  const RGWPubSub ps(driver, s->owner.id.tenant,
-                     &s->penv.site->get_period()->get_map().zonegroups);
+  const RGWPubSub ps(driver, s->owner.id.tenant, *s->penv.site);
   op_ret = ps.create_topic(this, topic_name, dest, topic_arn, opaque_data,
                            s->owner.id, policy_text, y);
   if (op_ret < 0) {
@@ -334,8 +332,7 @@ public:
 };
 
 void RGWPSListTopicsOp::execute(optional_yield y) {
-  const RGWPubSub ps(driver, s->owner.id.tenant,
-                     &s->penv.site->get_period()->get_map().zonegroups);
+  const RGWPubSub ps(driver, s->owner.id.tenant, *s->penv.site);
   op_ret = ps.get_topics(this, result, y);
   // if there are no topics it is not considered an error
   op_ret = op_ret == -ENOENT ? 0 : op_ret;
@@ -422,8 +419,7 @@ void RGWPSGetTopicOp::execute(optional_yield y) {
   if (op_ret < 0) {
     return;
   }
-  const RGWPubSub ps(driver, s->owner.id.tenant,
-                     &s->penv.site->get_period()->get_map().zonegroups);
+  const RGWPubSub ps(driver, s->owner.id.tenant, *s->penv.site);
   op_ret = ps.get_topic(this, topic_name, result, y, nullptr);
   if (op_ret < 0) {
     ldpp_dout(this, 1) << "failed to get topic '" << topic_name << "', ret=" << op_ret << dendl;
@@ -507,8 +503,7 @@ void RGWPSGetTopicAttributesOp::execute(optional_yield y) {
   if (op_ret < 0) {
     return;
   }
-  const RGWPubSub ps(driver, s->owner.id.tenant,
-                     &s->penv.site->get_period()->get_map().zonegroups);
+  const RGWPubSub ps(driver, s->owner.id.tenant, *s->penv.site);
   op_ret = ps.get_topic(this, topic_name, result, y, nullptr);
   if (op_ret < 0) {
     ldpp_dout(this, 1) << "failed to get topic '" << topic_name << "', ret=" << op_ret << dendl;
@@ -636,8 +631,7 @@ class RGWPSSetTopicAttributesOp : public RGWOp {
       return ret;
     }
     rgw_pubsub_topic result;
-    const RGWPubSub ps(driver, s->owner.id.tenant,
-                       &s->penv.site->get_period()->get_map().zonegroups);
+    const RGWPubSub ps(driver, s->owner.id.tenant, *s->penv.site);
     ret = ps.get_topic(this, topic_name, result, y, nullptr);
     if (ret < 0) {
       ldpp_dout(this, 1) << "failed to get topic '" << topic_name
@@ -715,8 +709,7 @@ void RGWPSSetTopicAttributesOp::execute(optional_yield y) {
       return;
     }
   }
-  const RGWPubSub ps(driver, s->owner.id.tenant,
-                     &s->penv.site->get_period()->get_map().zonegroups);
+  const RGWPubSub ps(driver, s->owner.id.tenant, *s->penv.site);
   op_ret = ps.create_topic(this, topic_name, dest, topic_arn, opaque_data,
                            topic_owner, policy_text, y);
   if (op_ret < 0) {
@@ -797,8 +790,7 @@ void RGWPSDeleteTopicOp::execute(optional_yield y) {
       return;
     }
   }
-  const RGWPubSub ps(driver, s->owner.id.tenant,
-                     &s->penv.site->get_period()->get_map().zonegroups);
+  const RGWPubSub ps(driver, s->owner.id.tenant, *s->penv.site);
 
   rgw_pubsub_topic result;
   op_ret = ps.get_topic(this, topic_name, result, y, nullptr);
@@ -991,8 +983,7 @@ public:
 };
 
 void RGWPSCreateNotifOp::execute(optional_yield y) {
-  if (do_all_zonegroups_support_notification_v2(
-          s->penv.site->get_period()->get_map().zonegroups)) {
+  if (rgw::all_zonegroups_support(*s->penv.site, rgw::zone_features::notification_v2)) {
     return execute_v2(y);
   }
   op_ret = verify_params();
@@ -1174,8 +1165,7 @@ void RGWPSCreateNotifOp::execute_v2(optional_yield y) {
         << "' , ret = " << op_ret << dendl;
     return;
   }
-  const RGWPubSub ps(driver, s->owner.id.tenant,
-                     &s->penv.site->get_period()->get_map().zonegroups);
+  const RGWPubSub ps(driver, s->owner.id.tenant, *s->penv.site);
   std::unordered_map<std::string, rgw_pubsub_topic> topics;
   for (const auto& c : configurations.list) {
     const auto& notif_name = c.id;
@@ -1295,8 +1285,7 @@ class RGWPSDeleteNotifOp : public RGWDefaultResponseOp {
 };
 
 void RGWPSDeleteNotifOp::execute(optional_yield y) {
-  if (do_all_zonegroups_support_notification_v2(
-          s->penv.site->get_period()->get_map().zonegroups)) {
+  if (rgw::all_zonegroups_support(*s->penv.site, rgw::zone_features::notification_v2)) {
     return execute_v2(y);
   }
   std::string notif_name;
@@ -1457,8 +1446,7 @@ void RGWPSListNotifsOp::execute(optional_yield y) {
 
   // get all topics on a bucket
   rgw_pubsub_bucket_topics bucket_topics;
-  if (do_all_zonegroups_support_notification_v2(
-          s->penv.site->get_period()->get_map().zonegroups)) {
+  if (rgw::all_zonegroups_support(*s->penv.site, rgw::zone_features::notification_v2)) {
     op_ret = get_bucket_notifications(this, bucket.get(), bucket_topics);
   } else {
     const RGWPubSub ps(driver, s->owner.id.tenant);
index 4dc3c9dc83651ede345fa627f5e3021720da1c0f..f1bc455835f6b1c709f01b8cb0f714b2fcddfa1b 100644 (file)
@@ -1495,8 +1495,6 @@ public:
   virtual int list_zones(std::list<std::string>& zone_ids) = 0;
   /** Clone a copy of this zonegroup. */
   virtual std::unique_ptr<ZoneGroup> clone() = 0;
-  /** Determine if zonegroup |feature| is supported.*/
-  virtual bool supports_feature(std::string_view feature) const = 0;
 };
 
 /**
index 140b28396626d906961979dfe222bbc55b02151e..3c0c7c765198bdcaf31b944068c4f3c341060b9d 100644 (file)
@@ -259,9 +259,6 @@ protected:
       std::unique_ptr<RGWZoneGroup>zg = std::make_unique<RGWZoneGroup>(*group.get());
       return std::make_unique<DBZoneGroup>(store, std::move(zg));
     }
-    virtual bool supports_feature(std::string_view feature) const override {
-      return group->supports(feature);
-    }
   };
 
   class DBZone : public StoreZone {
index d5bf9afe248cc418ef92703b1b91d518978b3f76..8bb704ce17c1b2f94cdf37748faf128da9d457f4 100644 (file)
@@ -75,9 +75,6 @@ public:
     std::unique_ptr<ZoneGroup> nzg = next->clone();
     return std::make_unique<FilterZoneGroup>(std::move(nzg));
   }
-  virtual bool supports_feature(std::string_view feature) const override {
-    return next->supports_feature(feature);
-  }
 };
 
 class FilterZone : public Zone {