]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
RGW Zipper - Add zone abstraction
authorDaniel Gryniewicz <dang@redhat.com>
Thu, 21 Jan 2021 17:11:30 +0000 (12:11 -0500)
committerDaniel Gryniewicz <dang@redhat.com>
Tue, 2 Mar 2021 12:35:05 +0000 (07:35 -0500)
Signed-off-by: Daniel Gryniewicz <dang@redhat.com>
32 files changed:
src/rgw/librgw.cc
src/rgw/rgw_admin.cc
src/rgw/rgw_asio_frontend.cc
src/rgw/rgw_file.cc
src/rgw/rgw_lc.cc
src/rgw/rgw_lua.cc
src/rgw/rgw_main.cc
src/rgw/rgw_obj_manifest.cc
src/rgw/rgw_obj_manifest.h
src/rgw/rgw_object_expirer_core.cc
src/rgw/rgw_object_expirer_core.h
src/rgw/rgw_oidc_provider.cc
src/rgw/rgw_op.cc
src/rgw/rgw_orphan.cc
src/rgw/rgw_period_pusher.cc
src/rgw/rgw_putobj_processor.cc
src/rgw/rgw_realm_reloader.cc
src/rgw/rgw_rest_config.cc
src/rgw/rgw_rest_conn.cc
src/rgw/rgw_rest_log.cc
src/rgw/rgw_rest_pubsub.cc
src/rgw/rgw_rest_realm.cc
src/rgw/rgw_rest_s3.cc
src/rgw/rgw_rest_swift.cc
src/rgw/rgw_rest_user.cc
src/rgw/rgw_role.cc
src/rgw/rgw_sal.h
src/rgw/rgw_sal_rados.cc
src/rgw/rgw_sal_rados.h
src/rgw/rgw_sync_module_pubsub_rest.cc
src/rgw/rgw_tools.cc
src/rgw/rgw_trim_bilog.cc

index 6c215eac141bdf7054a6dcbbc7764acebc1657c3..012cc54c3be8509cf1088e0db0d48978b3dc201c 100644 (file)
@@ -556,7 +556,7 @@ namespace rgw {
 
     r = rgw_perf_start(g_ceph_context);
 
-    rgw_rest_init(g_ceph_context, store->get_zonegroup());
+    rgw_rest_init(g_ceph_context, store->get_zone()->get_zonegroup());
 
     mutex.lock();
     init_timer.cancel_all_events();
index 07f99f873e5122a64fb144b44644c6fee8be04e2..c302c2fd7dd6297be5bbee2c51cb868d30a1b4ea 100644 (file)
@@ -1632,7 +1632,7 @@ static int commit_period(RGWRealm& realm, RGWPeriod& period,
     return -EINVAL;
   }
   // are we the period's master zone?
-  if (store->get_zone_id() == master_zone) {
+  if (store->get_zone()->get_id() == master_zone) {
     // read the current period
     RGWPeriod current_period;
     int ret = current_period.init(g_ceph_context,
@@ -2178,8 +2178,8 @@ static void tab_dump(const string& header, int width, const list<string>& entrie
 
 static void sync_status(Formatter *formatter)
 {
-  const RGWRealm& realm = store->get_realm();
-  const RGWZoneGroup& zonegroup = store->get_zonegroup();
+  const RGWRealm& realm = store->get_zone()->get_realm();
+  const RGWZoneGroup& zonegroup = store->get_zone()->get_zonegroup();
   const RGWZone& zone = static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone->get_zone();
 
   int width = 15;
@@ -2374,7 +2374,7 @@ rgw_zone_id validate_zone_id(const rgw_zone_id& zone_id)
 
 static int sync_info(std::optional<rgw_zone_id> opt_target_zone, std::optional<rgw_bucket> opt_bucket, Formatter *formatter)
 {
-  rgw_zone_id zone_id = opt_target_zone.value_or(store->get_zone_id());
+  rgw_zone_id zone_id = opt_target_zone.value_or(store->get_zone()->get_id());
 
   auto zone_policy_handler = static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone->get_sync_policy_handler(zone_id);
 
@@ -2488,8 +2488,8 @@ static int sync_info(std::optional<rgw_zone_id> opt_target_zone, std::optional<r
 static int bucket_sync_info(rgw::sal::RGWRadosStore *store, const RGWBucketInfo& info,
                               std::ostream& out)
 {
-  const RGWRealm& realm = store->get_realm();
-  const RGWZoneGroup& zonegroup = store->get_zonegroup();
+  const RGWRealm& realm = store->get_zone()->get_realm();
+  const RGWZoneGroup& zonegroup = store->get_zone()->get_zonegroup();
   const RGWZone& zone = store->svc()->zone->get_zone();
   constexpr int width = 15;
 
@@ -2529,8 +2529,8 @@ static int bucket_sync_status(rgw::sal::RGWRadosStore *store, const RGWBucketInf
                              std::optional<rgw_bucket>& opt_source_bucket,
                               std::ostream& out)
 {
-  const RGWRealm& realm = store->get_realm();
-  const RGWZoneGroup& zonegroup = store->get_zonegroup();
+  const RGWRealm& realm = store->get_zone()->get_realm();
+  const RGWZoneGroup& zonegroup = store->get_zone()->get_zonegroup();
   const RGWZone& zone = static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone->get_zone();
   constexpr int width = 15;
 
@@ -5516,7 +5516,7 @@ int main(int argc, const char **argv)
     rgw_placement_rule target_rule;
     target_rule.name = placement_id;
     target_rule.storage_class = *opt_storage_class;
-    if (!store->get_zone_params().valid_placement(target_rule)) {
+    if (!store->get_zone()->get_params().valid_placement(target_rule)) {
       cerr << "NOTICE: invalid dest placement: " << target_rule.to_str() << std::endl;
       return EINVAL;
     }
@@ -7874,7 +7874,7 @@ next:
 
     RGWSyncModuleInstanceRef sync_module;
     int ret = static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->sync_modules->get_manager()->create_instance(g_ceph_context, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone->get_zone().tier_type,
-        store->get_zone_params().tier_config, &sync_module);
+        store->get_zone()->get_params().tier_config, &sync_module);
     if (ret < 0) {
       lderr(cct) << "ERROR: failed to init sync module instance, ret=" << ret << dendl;
       return ret;
index e140c40b2deb9da00754fa510297685da4633e3d..df6f9a91accc6716c812921993f0b4dcb8447ebd 100644 (file)
@@ -629,13 +629,13 @@ class ExpandMetaVar {
   map<string, string> meta_map;
 
 public:
-  ExpandMetaVar(RGWSI_Zone *zone_svc) {
+  ExpandMetaVar(rgw::sal::Zone *zone_svc) {
     meta_map["realm"] = zone_svc->get_realm().get_name();
     meta_map["realm_id"] = zone_svc->get_realm().get_id();
     meta_map["zonegroup"] = zone_svc->get_zonegroup().get_name();
     meta_map["zonegroup_id"] = zone_svc->get_zonegroup().get_id();
-    meta_map["zone"] = zone_svc->zone_name();
-    meta_map["zone_id"] = zone_svc->zone_id().id;
+    meta_map["zone"] = zone_svc->get_name();
+    meta_map["zone_id"] = zone_svc->get_id().id;
   }
 
   string process_str(const string& in);
@@ -815,7 +815,7 @@ int AsioFrontend::init_ssl()
       key_is_cert = true;
     }
 
-    ExpandMetaVar emv(static_cast<rgw::sal::RGWRadosStore*>(env.store)->svc()->zone);
+    ExpandMetaVar emv(env.store->get_zone());
 
     cert = emv.process_str(*cert);
     key = emv.process_str(*key);
index e46ce8adf2dcd8b9dc10a322df8198832bd69d87..b9cd6e02cc8ec16991b7798c41795ff9976adb31 100644 (file)
@@ -1786,7 +1786,7 @@ namespace rgw {
     state->object->set_bucket(state->bucket.get());
 
     auto compression_type =
-      get_store()->get_zone_params().get_compression_type(
+      get_store()->get_zone()->get_params().get_compression_type(
        state->bucket->get_placement_rule());
 
     /* not obviously supportable */
index ee9f7d8de353d40eafad1d24273bbf8184cd52b3..e1c79fa28ec92fdd87d9fce6097005a72ab9e5f2 100644 (file)
@@ -1256,7 +1256,7 @@ public:
     target_placement.inherit_from(oc.bucket->get_placement_rule());
     target_placement.storage_class = transition.storage_class;
 
-    if (!oc.store->get_zone_params().
+    if (!oc.store->get_zone()->get_params().
        valid_placement(target_placement)) {
       ldpp_dout(oc.dpp, 0) << "ERROR: non existent dest placement: "
                           << target_placement
index 8eed171da7fb5df21e7fba65d6835bc3f8565bd5..357b8444eeec169ddc752cee8b083925f4b32cef 100644 (file)
@@ -67,7 +67,7 @@ int read_script(const DoutPrefixProvider *dpp, rgw::sal::RGWStore* store, const
 {
   RGWObjVersionTracker objv_tracker;
 
-  rgw_raw_obj obj(store->get_zone_params().log_pool, script_oid(ctx, tenant));
+  rgw_raw_obj obj(store->get_zone()->get_params().log_pool, script_oid(ctx, tenant));
 
   bufferlist bl;
   
@@ -100,7 +100,7 @@ int write_script(rgw::sal::RGWStore* store, const std::string& tenant, optional_
 {
   RGWObjVersionTracker objv_tracker;
 
-  rgw_raw_obj obj(store->get_zone_params().log_pool, script_oid(ctx, tenant));
+  rgw_raw_obj obj(store->get_zone()->get_params().log_pool, script_oid(ctx, tenant));
 
   bufferlist bl;
   ceph::encode(script, bl);
@@ -125,7 +125,7 @@ int delete_script(rgw::sal::RGWStore* store, const std::string& tenant, optional
 {
   RGWObjVersionTracker objv_tracker;
 
-  rgw_raw_obj obj(store->get_zone_params().log_pool, script_oid(ctx, tenant));
+  rgw_raw_obj obj(store->get_zone()->get_params().log_pool, script_oid(ctx, tenant));
 
   const auto rc = store->delete_system_obj(
       obj.pool,
index 36ac9f3115af2f4ac1a3d5bf87fd71ee7d0db10a..04dbdc4432b86522ee2ab271cdbb9f7f706d3231 100644 (file)
@@ -352,7 +352,7 @@ int radosgw_Main(int argc, const char **argv)
     return -r;
   }
 
-  rgw_rest_init(g_ceph_context, store->get_zonegroup());
+  rgw_rest_init(g_ceph_context, store->get_zone()->get_zonegroup());
 
   mutex.lock();
   init_timer.cancel_all_events();
@@ -449,7 +449,7 @@ int radosgw_Main(int argc, const char **argv)
                           set_logging(rest_filter(store, RGW_REST_SWIFT,
                                                   swift_resource)));
     } else {
-      if (store->get_zonegroup().zones.size() > 1) {
+      if (store->get_zone()->get_zonegroup().zones.size() > 1) {
         derr << "Placing Swift API in the root of URL hierarchy while running"
              << " multi-site configuration requires another instance of RadosGW"
              << " with S3 API enabled!" << dendl;
@@ -632,7 +632,7 @@ int radosgw_Main(int argc, const char **argv)
   auto reloader = std::make_unique<RGWRealmReloader>(store,
                                                     service_map_meta, &pauser);
 
-  RGWRealmWatcher realm_watcher(g_ceph_context, store->get_realm());
+  RGWRealmWatcher realm_watcher(g_ceph_context, store->get_zone()->get_realm());
   realm_watcher.add_watcher(RGWRealmNotify::Reload, *reloader);
   realm_watcher.add_watcher(RGWRealmNotify::ZonesNeedPeriod, pusher);
 
index a91c51c4658eace59a1636901fc0c2e3bbb1a654..e1fcc3af979612ad4a5ed7b1856a15ee635d0015 100644 (file)
@@ -138,9 +138,9 @@ int RGWObjManifest::append(RGWObjManifest& m, const RGWZoneGroup& zonegroup,
   return 0;
 }
 
-int RGWObjManifest::append(RGWObjManifest& m, RGWSI_Zone *zone_svc)
+int RGWObjManifest::append(RGWObjManifest& m, rgw::sal::Zone* zone_svc)
 {
-  return append(m, zone_svc->get_zonegroup(), zone_svc->get_zone_params());
+  return append(m, zone_svc->get_zonegroup(), zone_svc->get_params());
 }
 
 void RGWObjManifest::append_rules(RGWObjManifest& m, map<uint64_t, RGWObjManifestRule>::iterator& miter,
index 5423dea356483d97c733a7a22a8f9cf08bb72503..36f01bc9ec6b1cb3946cbb4e405c49930baaec84 100644 (file)
@@ -327,7 +327,7 @@ public:
 
   int append(RGWObjManifest& m, const RGWZoneGroup& zonegroup,
              const RGWZoneParams& zone_params);
-  int append(RGWObjManifest& m, RGWSI_Zone *zone_svc);
+  int append(RGWObjManifest& m, rgw::sal::Zone* zone);
 
   bool get_rule(uint64_t ofs, RGWObjManifestRule *rule);
 
index 559d1ff63b1f348458f8ed7987bc4ab223124f9e..c7b152d4ccb8fcf6b8c5de0bd1c00fede4ecf3b3 100644 (file)
@@ -105,7 +105,7 @@ int RGWObjExpStore::objexp_hint_add(const ceph::real_time& delete_at,
   cls_timeindex_add(op, utime_t(delete_at), keyext, hebl);
 
   string shard_name = objexp_hint_get_shardname(objexp_key_shard(obj_key, cct->_conf->rgw_objexp_hints_num_shards));
-  auto obj = rados_svc->obj(rgw_raw_obj(zone_svc->get_zone_params().log_pool, shard_name));
+  auto obj = rados_svc->obj(rgw_raw_obj(zone_svc->get_params().log_pool, shard_name));
   int r = obj.open();
   if (r < 0) {
     ldout(cct, 0) << "ERROR: " << __func__ << "(): failed to open obj=" << obj << " (r=" << r << ")" << dendl;
@@ -127,7 +127,7 @@ int RGWObjExpStore::objexp_hint_list(const string& oid,
   cls_timeindex_list(op, utime_t(start_time), utime_t(end_time), marker, max_entries, entries,
         out_marker, truncated);
 
-  auto obj = rados_svc->obj(rgw_raw_obj(zone_svc->get_zone_params().log_pool, oid));
+  auto obj = rados_svc->obj(rgw_raw_obj(zone_svc->get_params().log_pool, oid));
   int r = obj.open();
   if (r < 0) {
     ldout(cct, 0) << "ERROR: " << __func__ << "(): failed to open obj=" << obj << " (r=" << r << ")" << dendl;
@@ -174,7 +174,7 @@ int RGWObjExpStore::objexp_hint_trim(const string& oid,
                                const string& from_marker,
                                const string& to_marker)
 {
-  auto obj = rados_svc->obj(rgw_raw_obj(zone_svc->get_zone_params().log_pool, oid));
+  auto obj = rados_svc->obj(rgw_raw_obj(zone_svc->get_params().log_pool, oid));
   int r = obj.open();
   if (r < 0) {
     ldout(cct, 0) << "ERROR: " << __func__ << "(): failed to open obj=" << obj << " (r=" << r << ")" << dendl;
index 15c1bcaf90b3640edce04ffa326d2d0d64bfe83f..ab653a566dc1a6001001369414bc7cd70ad98d86 100644 (file)
@@ -40,9 +40,9 @@ class cls_timeindex_entry;
 class RGWObjExpStore {
   CephContext *cct;
   RGWSI_RADOS *rados_svc;
-  RGWSI_Zone *zone_svc;
+  rgw::sal::Zone* zone_svc;
 public:
-  RGWObjExpStore(CephContext *_cct, RGWSI_RADOS *_rados_svc, RGWSI_Zone *_zone_svc) : cct(_cct),
+  RGWObjExpStore(CephContext *_cct, RGWSI_RADOS *_rados_svc, rgw::sal::Zone* _zone_svc) : cct(_cct),
                                                                                       rados_svc(_rados_svc),
                                                                                       zone_svc(_zone_svc) {}
 
@@ -100,7 +100,7 @@ protected:
 public:
   explicit RGWObjectExpirer(rgw::sal::RGWStore *_store)
     : store(_store),
-      exp_store(_store->ctx(), static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->rados, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone),
+      exp_store(_store->ctx(), static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->rados, store->get_zone()),
       worker(NULL) {
   }
   ~RGWObjectExpirer() {
index 7e420bbeb5273edb69ad4d473d7162552fb83d78..b4aa9ea4026c97765df45ffde6dd70056e8d8e02 100644 (file)
@@ -35,7 +35,7 @@ int RGWOIDCProvider::store_url(const string& url, bool exclusive,
 
   bufferlist bl;
   encode(*this, bl);
-  return store->put_system_obj(store->get_zone_params().oidc_pool, oid,
+  return store->put_system_obj(store->get_zone()->get_params().oidc_pool, oid,
                               bl, exclusive, NULL, real_time(), y);
 }
 
@@ -92,7 +92,7 @@ int RGWOIDCProvider::create(const DoutPrefixProvider *dpp, bool exclusive, optio
   sprintf(buf + strlen(buf),".%dZ",(int)tv.tv_usec/1000);
   creation_date.assign(buf, strlen(buf));
 
-  auto& pool = store->get_zone_params().oidc_pool;
+  auto& pool = store->get_zone()->get_params().oidc_pool;
   ret = store_url(idp_url, exclusive, y);
   if (ret < 0) {
     ldpp_dout(dpp, 0) << "ERROR:  storing role info in pool: " << pool.name << ": "
@@ -105,7 +105,7 @@ int RGWOIDCProvider::create(const DoutPrefixProvider *dpp, bool exclusive, optio
 
 int RGWOIDCProvider::delete_obj(optional_yield y)
 {
-  auto& pool = store->get_zone_params().oidc_pool;
+  auto& pool = store->get_zone()->get_params().oidc_pool;
 
   string url, tenant;
   auto ret = get_tenant_url_from_arn(tenant, url);
@@ -182,7 +182,7 @@ void RGWOIDCProvider::decode_json(JSONObj *obj)
 
 int RGWOIDCProvider::read_url(const DoutPrefixProvider *dpp, const string& url, const string& tenant)
 {
-  auto& pool = store->get_zone_params().oidc_pool;
+  auto& pool = store->get_zone()->get_params().oidc_pool;
   string oid = tenant + get_url_oid_prefix() + url;
   bufferlist bl;
 
@@ -240,7 +240,7 @@ int RGWOIDCProvider::get_providers(const DoutPrefixProvider *dpp,
                                   const string& tenant,
                                   vector<RGWOIDCProvider>& providers)
 {
-  auto pool = store->get_zone_params().oidc_pool;
+  auto pool = store->get_zone()->get_params().oidc_pool;
   string prefix = tenant + oidc_url_oid_prefix;
 
   //Get the filtered objects
index 335399324d4f45645d2f85629d273ad2a18b3a64..43844e59ba694a23ffa35dc7326a7eaedd97ac9f 100644 (file)
@@ -550,7 +550,7 @@ int rgw_build_bucket_policies(const DoutPrefixProvider *dpp, rgw::sal::RGWStore*
                            &src_bucket, y);
     if (ret == 0) {
       string& zonegroup = src_bucket->get_info().zonegroup;
-      s->local_source = store->get_zonegroup().equals(zonegroup);
+      s->local_source = store->get_zone()->get_zonegroup().equals(zonegroup);
     }
   }
 
@@ -591,7 +591,7 @@ int rgw_build_bucket_policies(const DoutPrefixProvider *dpp, rgw::sal::RGWStore*
     s->bucket_owner = s->bucket_acl->get_owner();
 
     RGWZoneGroup zonegroup;
-    int r = store->get_zonegroup(s->bucket->get_info().zonegroup, zonegroup);
+    int r = store->get_zone()->get_zonegroup(s->bucket->get_info().zonegroup, zonegroup);
     if (!r) {
       if (!zonegroup.endpoints.empty()) {
        s->zonegroup_endpoint = zonegroup.endpoints.front();
@@ -608,14 +608,14 @@ int rgw_build_bucket_policies(const DoutPrefixProvider *dpp, rgw::sal::RGWStore*
       ret = r;
     }
 
-    if (!store->get_zonegroup().equals(s->bucket->get_info().zonegroup)) {
+    if (!store->get_zone()->get_zonegroup().equals(s->bucket->get_info().zonegroup)) {
       ldpp_dout(dpp, 0) << "NOTICE: request for data in a different zonegroup ("
           << s->bucket->get_info().zonegroup << " != "
-          << store->get_zonegroup().get_id() << ")" << dendl;
+          << store->get_zone()->get_zonegroup().get_id() << ")" << dendl;
       /* we now need to make sure that the operation actually requires copy source, that is
        * it's a copy operation
        */
-      if (store->get_zonegroup().is_master_zonegroup() && s->system_request) {
+      if (store->get_zone()->get_zonegroup().is_master_zonegroup() && s->system_request) {
         /*If this is the master, don't redirect*/
       } else if (s->op_type == RGW_OP_GET_BUCKET_LOCATION ) {
         /* If op is get bucket location, don't redirect */
@@ -630,7 +630,7 @@ int rgw_build_bucket_policies(const DoutPrefixProvider *dpp, rgw::sal::RGWStore*
     s->dest_placement.storage_class = s->info.storage_class;
     s->dest_placement.inherit_from(s->bucket->get_placement_rule());
 
-    if (!store->get_zone_params().valid_placement(s->dest_placement)) {
+    if (!store->get_zone()->get_params().valid_placement(s->dest_placement)) {
       ldpp_dout(dpp, 0) << "NOTICE: invalid dest placement: " << s->dest_placement.to_str() << dendl;
       return -EINVAL;
     }
@@ -696,7 +696,7 @@ int rgw_build_bucket_policies(const DoutPrefixProvider *dpp, rgw::sal::RGWStore*
     ret = -EACCES;
   }
 
-  bool success = static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone->get_redirect_zone_endpoint(&s->redirect_zone_endpoint);
+  bool success = store->get_zone()->get_redirect_endpoint(&s->redirect_zone_endpoint);
   if (success) {
     ldpp_dout(dpp, 20) << "redirect_zone_endpoint=" << s->redirect_zone_endpoint << dendl;
   }
@@ -943,7 +943,7 @@ int RGWOp::verify_op_mask()
     return -EPERM;
   }
 
-  if (!s->system_request && (required_mask & RGW_OP_TYPE_MODIFY) && !static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone->zone_is_writeable()) {
+  if (!s->system_request && (required_mask & RGW_OP_TYPE_MODIFY) && !store->get_zone()->is_writeable()) {
     ldpp_dout(this, 5) << "NOTICE: modify request to a read-only zone by a "
         "non-system user, permission denied"  << dendl;
     return -EPERM;
@@ -2317,7 +2317,7 @@ void RGWListBuckets::execute(optional_yield y)
     /* We need to have stats for all our policies - even if a given policy
      * isn't actually used in a given account. In such situation its usage
      * stats would be simply full of zeros. */
-    for (const auto& policy : store->get_zonegroup().placement_targets) {
+    for (const auto& policy : store->get_zone()->get_zonegroup().placement_targets) {
       policies_stats.emplace(policy.second.name,
                              decltype(policies_stats)::mapped_type());
     }
@@ -2458,7 +2458,7 @@ void RGWStatAccount::execute(optional_yield y)
       /* We need to have stats for all our policies - even if a given policy
        * isn't actually used in a given account. In such situation its usage
        * stats would be simply full of zeros. */
-      for (const auto& policy : store->get_zonegroup().placement_targets) {
+      for (const auto& policy : store->get_zone()->get_zonegroup().placement_targets) {
         policies_stats.emplace(policy.second.name,
                                decltype(policies_stats)::mapped_type());
       }
@@ -3036,7 +3036,7 @@ void RGWCreateBucket::execute(optional_yield y)
   buffer::list aclbl;
   buffer::list corsbl;
   string bucket_name = rgw_make_bucket_entry_name(s->bucket_tenant, s->bucket_name);
-  rgw_raw_obj obj(store->get_zone_params().domain_root, bucket_name);
+  rgw_raw_obj obj(store->get_zone()->get_params().domain_root, bucket_name);
 
   op_ret = get_params(y);
   if (op_ret < 0)
@@ -3044,7 +3044,7 @@ void RGWCreateBucket::execute(optional_yield y)
 
   if (!relaxed_region_enforcement &&
       !location_constraint.empty() &&
-      !static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone->has_zonegroup_api(location_constraint)) {
+      !store->get_zone()->has_zonegroup_api(location_constraint)) {
       ldpp_dout(this, 0) << "location constraint (" << location_constraint << ")"
                        << " can't be found." << dendl;
       op_ret = -ERR_INVALID_LOCATION_CONSTRAINT;
@@ -3052,22 +3052,22 @@ void RGWCreateBucket::execute(optional_yield y)
       return;
   }
 
-  if (!relaxed_region_enforcement && !store->get_zonegroup().is_master_zonegroup() && !location_constraint.empty() &&
-      store->get_zonegroup().api_name != location_constraint) {
+  if (!relaxed_region_enforcement && !store->get_zone()->get_zonegroup().is_master_zonegroup() && !location_constraint.empty() &&
+      store->get_zone()->get_zonegroup().api_name != location_constraint) {
     ldpp_dout(this, 0) << "location constraint (" << location_constraint << ")"
-                     << " doesn't match zonegroup" << " (" << store->get_zonegroup().api_name << ")"
+                     << " doesn't match zonegroup" << " (" << store->get_zone()->get_zonegroup().api_name << ")"
                      << dendl;
     op_ret = -ERR_INVALID_LOCATION_CONSTRAINT;
     s->err.message = "The specified location-constraint is not valid";
     return;
   }
 
-  const auto& zonegroup = store->get_zonegroup();
+  const auto& zonegroup = store->get_zone()->get_zonegroup();
   if (!placement_rule.name.empty() &&
       !zonegroup.placement_targets.count(placement_rule.name)) {
     ldpp_dout(this, 0) << "placement target (" << placement_rule.name << ")"
                      << " doesn't exist in the placement targets of zonegroup"
-                     << " (" << store->get_zonegroup().api_name << ")" << dendl;
+                     << " (" << store->get_zone()->get_zonegroup().api_name << ")" << dendl;
     op_ret = -ERR_INVALID_LOCATION_CONSTRAINT;
     s->err.message = "The specified placement target does not exist";
     return;
@@ -3082,7 +3082,7 @@ void RGWCreateBucket::execute(optional_yield y)
 
   if (s->bucket_exists) {
     if (!s->system_request &&
-        store->get_zonegroup().get_id() != s->bucket->get_info().zonegroup) {
+        store->get_zone()->get_zonegroup().get_id() != s->bucket->get_info().zonegroup) {
       op_ret = -EEXIST;
       return;
     }
@@ -3098,10 +3098,10 @@ void RGWCreateBucket::execute(optional_yield y)
   if (s->system_request) {
     zonegroup_id = s->info.args.get(RGW_SYS_PARAM_PREFIX "zonegroup");
     if (zonegroup_id.empty()) {
-      zonegroup_id = store->get_zonegroup().get_id();
+      zonegroup_id = store->get_zone()->get_zonegroup().get_id();
     }
   } else {
-    zonegroup_id = store->get_zonegroup().get_id();
+    zonegroup_id = store->get_zone()->get_zonegroup().get_id();
   }
 
   /* Encode special metadata first as we're using std::map::emplace under
@@ -3870,7 +3870,7 @@ void RGWPutObj::execute(optional_yield y)
   // no filters by default
   DataProcessor *filter = processor.get();
 
-  const auto& compression_type = store->get_zone_params().get_compression_type(*pdest_placement);
+  const auto& compression_type = store->get_zone()->get_params().get_compression_type(*pdest_placement);
   CompressorRef plugin;
   boost::optional<RGWPutObj_Compress> compressor;
 
@@ -4190,7 +4190,7 @@ void RGWPostObj::execute(optional_yield y)
     if (encrypt != nullptr) {
       filter = encrypt.get();
     } else {
-      const auto& compression_type = store->get_zone_params().get_compression_type(
+      const auto& compression_type = store->get_zone()->get_params().get_compression_type(
           s->dest_placement);
       if (compression_type != "none") {
         plugin = Compressor::create(s->cct, compression_type);
@@ -6020,7 +6020,7 @@ void RGWCompleteMultipart::execute(optional_yield y)
         op_ret = -ERR_INVALID_PART;
         return;
       } else {
-        manifest.append(obj_part.manifest, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone);
+        manifest.append(obj_part.manifest, store->get_zone());
       }
 
       bool part_compressed = (obj_part.cs_info.compression_type != "none");
@@ -6825,7 +6825,7 @@ int RGWBulkUploadOp::handle_dir(const std::string_view path, optional_yield y)
   rgw_obj_key object_junk;
   std::tie(bucket_name, object_junk) =  *parse_path(path);
 
-  rgw_raw_obj obj(store->get_zone_params().domain_root,
+  rgw_raw_obj obj(store->get_zone()->get_params().domain_root,
                   rgw_make_bucket_entry_name(s->bucket_tenant, bucket_name));
 
   /* we need to make sure we read bucket info, it's not read before for this
@@ -6855,7 +6855,7 @@ int RGWBulkUploadOp::handle_dir(const std::string_view path, optional_yield y)
   forward_req_info(s->cct, info, bucket_name);
 
   op_ret = store->create_bucket(this, *s->user, new_bucket,
-                                store->get_zonegroup().get_id(),
+                                store->get_zone()->get_zonegroup().get_id(),
                                 placement_rule, swift_ver_location,
                                 pquota_info, policy, attrs,
                                 out_info, ep_objv,
@@ -7004,7 +7004,7 @@ int RGWBulkUploadOp::handle_file(const std::string_view path,
   /* No filters by default. */
   DataProcessor *filter = &processor;
 
-  const auto& compression_type = store->get_zone_params().get_compression_type(
+  const auto& compression_type = store->get_zone()->get_params().get_compression_type(
       dest_placement);
   CompressorRef plugin;
   boost::optional<RGWPutObj_Compress> compressor;
index 72e04b16606f82d86ba79ec361e1e39c55196675..377366b0da1ae2464f60f1354cad5ca964c12b33 100644 (file)
@@ -148,7 +148,7 @@ int RGWOrphanStore::list_jobs(map <string,RGWOrphanSearchState>& job_list)
 
 int RGWOrphanStore::init()
 {
-  const rgw_pool& log_pool = store->get_zone_params().log_pool;
+  const rgw_pool& log_pool = store->get_zone()->get_params().log_pool;
   int r = rgw_init_ioctx(static_cast<rgw::sal::RGWRadosStore*>(store)->getRados()->get_rados_handle(), log_pool, ioctx);
   if (r < 0) {
     cerr << "ERROR: failed to open log pool (" << log_pool << " ret=" << r << std::endl;
index aecb8b89ee9fe9fc374ed2db2c59a239edc1473e..9d5d3551c204610036d09f55bae65fc61fd7eed9 100644 (file)
@@ -162,7 +162,7 @@ RGWPeriodPusher::RGWPeriodPusher(rgw::sal::RGWStore* store,
                                 optional_yield y)
   : cct(store->ctx()), store(store)
 {
-  const auto& realm = store->get_realm();
+  const auto& realm = store->get_zone()->get_realm();
   auto& realm_id = realm.get_id();
   if (realm_id.empty()) // no realm configuration
     return;
@@ -225,7 +225,7 @@ void RGWPeriodPusher::handle_notify(RGWZonesNeedPeriod&& period)
 
   // find our zonegroup in the new period
   auto& zonegroups = period.get_map().zonegroups;
-  auto i = zonegroups.find(store->get_zonegroup().get_id());
+  auto i = zonegroups.find(store->get_zone()->get_zonegroup().get_id());
   if (i == zonegroups.end()) {
     lderr(cct) << "The new period does not contain my zonegroup!" << dendl;
     return;
@@ -233,7 +233,7 @@ void RGWPeriodPusher::handle_notify(RGWZonesNeedPeriod&& period)
   auto& my_zonegroup = i->second;
 
   // if we're not a master zone, we're not responsible for pushing any updates
-  if (my_zonegroup.master_zone != store->get_zone_params().get_id())
+  if (my_zonegroup.master_zone != store->get_zone()->get_params().get_id())
     return;
 
   // construct a map of the zones that need this period. the map uses the same
@@ -242,11 +242,11 @@ void RGWPeriodPusher::handle_notify(RGWZonesNeedPeriod&& period)
   auto hint = conns.end();
 
   // are we the master zonegroup in this period?
-  if (period.get_map().master_zonegroup == store->get_zonegroup().get_id()) {
+  if (period.get_map().master_zonegroup == store->get_zone()->get_zonegroup().get_id()) {
     // update other zonegroup endpoints
     for (auto& zg : zonegroups) {
       auto& zonegroup = zg.second;
-      if (zonegroup.get_id() == store->get_zonegroup().get_id())
+      if (zonegroup.get_id() == store->get_zone()->get_zonegroup().get_id())
         continue;
       if (zonegroup.endpoints.empty())
         continue;
@@ -261,7 +261,7 @@ void RGWPeriodPusher::handle_notify(RGWZonesNeedPeriod&& period)
   // update other zone endpoints
   for (auto& z : my_zonegroup.zones) {
     auto& zone = z.second;
-    if (zone.id == store->get_zone_params().get_id())
+    if (zone.id == store->get_zone()->get_params().get_id())
       continue;
     if (zone.endpoints.empty())
       continue;
index 12773ccf7c4dfb56ec6ad8bdeac1ce49fb0e5ad4..0f60ab9bce8ebe5bbea52caba95442958b85d74b 100644 (file)
@@ -504,7 +504,7 @@ int AppendObjectProcessor::complete(size_t accounted_size, const string &etag, c
   //For Append obj, disable versioning
   obj_op->params.versioning_disabled = true;
   if (cur_manifest) {
-    cur_manifest->append(manifest, static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone);
+    cur_manifest->append(manifest, store->get_zone());
     obj_op->params.manifest = cur_manifest;
   } else {
     obj_op->params.manifest = &manifest;
index 1721036388f64250ce95ebf9b7b994ee02c819f0..41bd283b8e4f33d93505c9d6a891023d77802ddf 100644 (file)
@@ -164,7 +164,7 @@ void RGWRealmReloader::reload()
   ldout(cct, 1) << "Finishing initialization of new store" << dendl;
   // finish initializing the new store
   ldout(cct, 1) << " - REST subsystem init" << dendl;
-  rgw_rest_init(cct, store->get_zonegroup());
+  rgw_rest_init(cct, store->get_zone()->get_zonegroup());
   ldout(cct, 1) << " - usage subsystem init" << dendl;
   rgw_log_usage_init(cct, store);
 
index 446e2792eb003024ac9088ba376854c9a6df16ec..ff3237c62afe91aa2d1479e6dcb72839dc466f78 100644 (file)
@@ -59,7 +59,7 @@ void RGWOp_ZoneGroupMap_Get::send_response() {
 }
 
 void RGWOp_ZoneConfig_Get::send_response() {
-  const RGWZoneParams& zone_params = store->get_zone_params();
+  const RGWZoneParams& zone_params = store->get_zone()->get_params();
 
   set_req_state_err(s, op_ret);
   dump_errno(s);
index 82e35c2514eb1369ac3c9ed6bde447f3edbe2dcf..285816d151f8efacf5f10487f46a08f4aebbb299 100644 (file)
@@ -33,8 +33,8 @@ RGWRESTConn::RGWRESTConn(CephContext *_cct, rgw::sal::RGWStore* store,
     remote_id(_remote_id), host_style(_host_style)
 {
   if (store) {
-    key = store->get_zone_params().system_key;
-    self_zone_group = store->get_zonegroup().get_id();
+    key = store->get_zone()->get_params().system_key;
+    self_zone_group = store->get_zone()->get_zonegroup().get_id();
   }
 }
 
@@ -64,7 +64,7 @@ RGWRESTConn::RGWRESTConn(CephContext *_cct, rgw::sal::RGWStore* store,
     remote_id(_remote_id), host_style(_host_style)
 {
   if (store) {
-    self_zone_group = store->get_zonegroup().get_id();
+    self_zone_group = store->get_zone()->get_zonegroup().get_id();
   }
 }
 
index bf1224cb7d672f330b7b499dcbdf6b52b50be1a6..62dab9b5d54b9bcb3fca5b7c3977178876e6af06 100644 (file)
@@ -74,7 +74,7 @@ void RGWOp_MDLog_List::execute(optional_yield y) {
 
   if (period.empty()) {
     ldout(s->cct, 5) << "Missing period id trying to use current" << dendl;
-    period = static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone->get_current_period_id();
+    period = store->get_zone()->get_current_period_id();
     if (period.empty()) {
       ldout(s->cct, 5) << "Missing period id" << dendl;
       op_ret = -EINVAL;
@@ -152,7 +152,7 @@ void RGWOp_MDLog_ShardInfo::execute(optional_yield y) {
 
   if (period.empty()) {
     ldout(s->cct, 5) << "Missing period id trying to use current" << dendl;
-    period = static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone->get_current_period_id();
+    period = store->get_zone()->get_current_period_id();
 
     if (period.empty()) {
       ldout(s->cct, 5) << "Missing period id" << dendl;
@@ -218,7 +218,7 @@ void RGWOp_MDLog_Delete::execute(optional_yield y) {
 
   if (period.empty()) {
     ldout(s->cct, 5) << "Missing period id trying to use current" << dendl;
-    period = static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone->get_current_period_id();
+    period = store->get_zone()->get_current_period_id();
 
     if (period.empty()) {
       ldout(s->cct, 5) << "Missing period id" << dendl;
@@ -245,7 +245,7 @@ void RGWOp_MDLog_Lock::execute(optional_yield y) {
 
   if (period.empty()) {
     ldout(s->cct, 5) << "Missing period id trying to use current" << dendl;
-    period = static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone->get_current_period_id();
+    period = store->get_zone()->get_current_period_id();
   }
 
   if (period.empty() ||
@@ -293,7 +293,7 @@ void RGWOp_MDLog_Unlock::execute(optional_yield y) {
 
   if (period.empty()) {
     ldout(s->cct, 5) << "Missing period id trying to use current" << dendl;
-    period = static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone->get_current_period_id();
+    period = store->get_zone()->get_current_period_id();
   }
 
   if (period.empty() ||
@@ -847,7 +847,7 @@ void RGWOp_BILog_Status::execute(optional_yield y)
     }
   }
 
-  const auto& local_zone_id = store->get_zone_id();
+  const auto& local_zone_id = store->get_zone()->get_id();
 
   if (!merge) {
     rgw_sync_bucket_pipe pipe;
index e05bedadf04cf76de2c21ea81b9865f766268c13..9c1a9a941fd4d1fe5ac2ebcd3e03e4ac2d156a4d 100644 (file)
@@ -69,7 +69,7 @@ public:
     dest.arn_topic = topic_name;
     // the topic ARN will be sent in the reply
     const rgw::ARN arn(rgw::Partition::aws, rgw::Service::sns, 
-        store->get_zonegroup().get_name(),
+        store->get_zone()->get_zonegroup().get_name(),
         s->user->get_tenant(), topic_name);
     topic_arn = arn.to_string();
     return 0;
index b128c9b9ac90633a5a52d9d4c72883ec92a35295..8c1cf57d2c74b33cbca6cf2ab280208cd67b4f8b 100644 (file)
@@ -108,9 +108,9 @@ void RGWOp_Period_Post::execute(optional_yield y)
   }
 
   // require period.realm_id to match our realm
-  if (period.get_realm() != store->get_realm().get_id()) {
+  if (period.get_realm() != store->get_zone()->get_realm().get_id()) {
     error_stream << "period with realm id " << period.get_realm()
-        << " doesn't match current realm " << store->get_realm().get_id() << std::endl;
+        << " doesn't match current realm " << store->get_zone()->get_realm().get_id() << std::endl;
     op_ret = -EINVAL;
     return;
   }
@@ -144,7 +144,7 @@ void RGWOp_Period_Post::execute(optional_yield y)
   }
 
   // if it's not period commit, nobody is allowed to push to the master zone
-  if (period.get_master_zone() == store->get_zone_params().get_id()) {
+  if (period.get_master_zone() == store->get_zone()->get_params().get_id()) {
     ldout(cct, 10) << "master zone rejecting period id="
         << period.get_id() << " epoch=" << period.get_epoch() << dendl;
     op_ret = -EINVAL; // XXX: error code
index 85c55ba1071c0467ea74311b47abdaf45158c0f5..2db083463a5a1f669f0f9cea708caedae7bdea6f 100644 (file)
@@ -1895,7 +1895,7 @@ void RGWGetBucketLocation_ObjStore_S3::send_response()
   RGWZoneGroup zonegroup;
   string api_name;
 
-  int ret = store->get_zonegroup(s->bucket->get_info().zonegroup, zonegroup);
+  int ret = store->get_zone()->get_zonegroup(s->bucket->get_info().zonegroup, zonegroup);
   if (ret >= 0) {
     api_name = zonegroup.api_name;
   } else  {
@@ -2731,7 +2731,7 @@ int RGWPostObj_ObjStore_S3::get_params(optional_yield y)
 
   if (! storage_class.empty()) {
     s->dest_placement.storage_class = storage_class;
-    if (!store->get_zone_params().valid_placement(s->dest_placement)) {
+    if (!store->get_zone()->get_params().valid_placement(s->dest_placement)) {
       ldpp_dout(this, 0) << "NOTICE: invalid dest placement: " << s->dest_placement.to_str() << dendl;
       err_msg = "The storage class you specified is not valid";
       return -EINVAL;
index d8b137701383d92ed223791a280ebdb7f1230f01..8b2280126fd0434b3cac974e043fbbd0c7d236e0 100644 (file)
@@ -711,7 +711,7 @@ int RGWCreateBucket_ObjStore_SWIFT::get_params(optional_yield y)
     policy.create_default(s->user->get_id(), s->user->get_display_name());
   }
 
-  location_constraint = store->get_zonegroup().api_name;
+  location_constraint = store->get_zone()->get_zonegroup().api_name;
   get_rmattrs_from_headers(s, CONT_PUT_ATTR_PREFIX,
                            CONT_REMOVE_ATTR_PREFIX, rmattr_names);
   placement_rule.init(s->info.env->get("HTTP_X_STORAGE_POLICY", ""), s->info.storage_class);
@@ -1896,7 +1896,7 @@ void RGWInfo_ObjStore_SWIFT::list_swift_data(Formatter& formatter,
   }
 
   formatter.open_array_section("policies");
-  const RGWZoneGroup& zonegroup = store->get_zonegroup();
+  const RGWZoneGroup& zonegroup = store->get_zone()->get_zonegroup();
 
   for (const auto& placement_targets : zonegroup.placement_targets) {
     formatter.open_object_section("policy");
index a87c64992c3978e994c45bb63af9e41dea0f48ac..a24d5c859302d9ec40b184d452c1e67348904b6c 100644 (file)
@@ -210,7 +210,7 @@ void RGWOp_User_Create::execute(optional_yield y)
   if (!default_placement_str.empty()) {
     rgw_placement_rule target_rule;
     target_rule.from_str(default_placement_str);
-    if (!store->get_zone_params().valid_placement(target_rule)) {
+    if (!store->get_zone()->get_params().valid_placement(target_rule)) {
       ldout(s->cct, 0) << "NOTICE: invalid dest placement: " << target_rule.to_str() << dendl;
       op_ret = -EINVAL;
       return;
@@ -352,7 +352,7 @@ void RGWOp_User_Modify::execute(optional_yield y)
   if (!default_placement_str.empty()) {
     rgw_placement_rule target_rule;
     target_rule.from_str(default_placement_str);
-    if (!store->get_zone_params().valid_placement(target_rule)) {
+    if (!store->get_zone()->get_params().valid_placement(target_rule)) {
       ldout(s->cct, 0) << "NOTICE: invalid dest placement: " << target_rule.to_str() << dendl;
       op_ret = -EINVAL;
       return;
index c3f408c0ba05dc4a6b81ae93a4d55acf3962adec..b7f5048a19791205d608962371c1a3dffbd16c9c 100644 (file)
@@ -38,7 +38,7 @@ int RGWRole::store_info(bool exclusive, optional_yield y)
   bufferlist bl;
   encode(*this, bl);
 
-  return store->put_system_obj(store->get_zone_params().roles_pool, oid,
+  return store->put_system_obj(store->get_zone()->get_params().roles_pool, oid,
                               bl, exclusive, NULL, real_time(), y, NULL);
 }
 
@@ -53,7 +53,7 @@ int RGWRole::store_name(bool exclusive, optional_yield y)
   using ceph::encode;
   encode(nameToId, bl);
 
-  return store->put_system_obj(store->get_zone_params().roles_pool, oid,
+  return store->put_system_obj(store->get_zone()->get_params().roles_pool, oid,
                               bl, exclusive, NULL, real_time(), y, NULL);
 }
 
@@ -62,7 +62,7 @@ int RGWRole::store_path(bool exclusive, optional_yield y)
   string oid = tenant + get_path_oid_prefix() + path + get_info_oid_prefix() + id;
 
   bufferlist bl;
-  return store->put_system_obj(store->get_zone_params().roles_pool, oid,
+  return store->put_system_obj(store->get_zone()->get_params().roles_pool, oid,
                               bl, exclusive, NULL, real_time(), y, NULL);
 }
 
@@ -109,7 +109,7 @@ int RGWRole::create(const DoutPrefixProvider *dpp, bool exclusive, optional_yiel
   sprintf(buf + strlen(buf),".%dZ",(int)tv.tv_usec/1000);
   creation_date.assign(buf, strlen(buf));
 
-  auto& pool = store->get_zone_params().roles_pool;
+  auto& pool = store->get_zone()->get_params().roles_pool;
   ret = store_info(exclusive, y);
   if (ret < 0) {
     ldpp_dout(dpp, 0) << "ERROR:  storing role info in pool: " << pool.name << ": "
@@ -157,7 +157,7 @@ int RGWRole::create(const DoutPrefixProvider *dpp, bool exclusive, optional_yiel
 
 int RGWRole::delete_obj(const DoutPrefixProvider *dpp, optional_yield y)
 {
-  auto& pool = store->get_zone_params().roles_pool;
+  auto& pool = store->get_zone()->get_params().roles_pool;
 
   int ret = read_name(dpp, y);
   if (ret < 0) {
@@ -226,7 +226,7 @@ int RGWRole::get_by_id(const DoutPrefixProvider *dpp, optional_yield y)
 
 int RGWRole::update(optional_yield y)
 {
-  auto& pool = store->get_zone_params().roles_pool;
+  auto& pool = store->get_zone()->get_params().roles_pool;
 
   int ret = store_info(false, y);
   if (ret < 0) {
@@ -302,7 +302,7 @@ void RGWRole::decode_json(JSONObj *obj)
 
 int RGWRole::read_id(const DoutPrefixProvider *dpp, const string& role_name, const string& tenant, string& role_id, optional_yield y)
 {
-  auto& pool = store->get_zone_params().roles_pool;
+  auto& pool = store->get_zone()->get_params().roles_pool;
   string oid = tenant + get_names_oid_prefix() + role_name;
   bufferlist bl;
 
@@ -327,7 +327,7 @@ int RGWRole::read_id(const DoutPrefixProvider *dpp, const string& role_name, con
 
 int RGWRole::read_info(const DoutPrefixProvider *dpp, optional_yield y)
 {
-  auto& pool = store->get_zone_params().roles_pool;
+  auto& pool = store->get_zone()->get_params().roles_pool;
   string oid = get_info_oid_prefix() + id;
   bufferlist bl;
 
@@ -353,7 +353,7 @@ int RGWRole::read_info(const DoutPrefixProvider *dpp, optional_yield y)
 
 int RGWRole::read_name(const DoutPrefixProvider *dpp, optional_yield y)
 {
-  auto& pool = store->get_zone_params().roles_pool;
+  auto& pool = store->get_zone()->get_params().roles_pool;
   string oid = tenant + get_names_oid_prefix() + name;
   bufferlist bl;
 
@@ -432,7 +432,7 @@ int RGWRole::get_roles_by_path_prefix(const DoutPrefixProvider *dpp,
                                       vector<RGWRole>& roles,
                                      optional_yield y)
 {
-  auto pool = store->get_zone_params().roles_pool;
+  auto pool = store->get_zone()->get_params().roles_pool;
   string prefix;
 
   // List all roles if path prefix is empty
index 4a244e0bbd975018ccbd48a2fb91be5b7902e5df..9077043c78a0bf96b11a0a14a314be9e94273f4d 100644 (file)
@@ -104,6 +104,7 @@ class Lifecycle;
 class Notification;
 class GCChain;
 class Writer;
+class Zone;
 
 enum AttrsMod {
   ATTRSMOD_NONE    = 0,
@@ -160,11 +161,7 @@ class RGWStore {
                                          optional_yield y) = 0;
     virtual int defer_gc(const DoutPrefixProvider *dpp, RGWObjectCtx *rctx, RGWBucket* bucket, RGWObject* obj,
                         optional_yield y) = 0;
-    virtual const RGWZoneGroup& get_zonegroup() = 0;
-    virtual int get_zonegroup(const string& id, RGWZoneGroup& zonegroup) = 0;
-    virtual const RGWZoneParams& get_zone_params() = 0;
-    virtual const rgw_zone_id& get_zone_id() = 0;
-    virtual const RGWRealm& get_realm() = 0;
+    virtual Zone* get_zone() = 0;
     virtual int cluster_stat(RGWClusterStat& stats) = 0;
     virtual std::unique_ptr<Lifecycle> get_lifecycle(void) = 0;
     virtual std::unique_ptr<Completions> get_completions(void) = 0;
@@ -886,6 +883,22 @@ protected:
 
 };
 
+class Zone {
+  public:
+    virtual ~Zone() = default;
+
+    virtual const RGWZoneGroup& get_zonegroup() = 0;
+    virtual int get_zonegroup(const string& id, RGWZoneGroup& zonegroup) = 0;
+    virtual const RGWZoneParams& get_params() = 0;
+    virtual const rgw_zone_id& get_id() = 0;
+    virtual const RGWRealm& get_realm() = 0;
+    virtual const std::string& get_name() const = 0;
+    virtual bool is_writeable() = 0;
+    virtual bool get_redirect_endpoint(string *endpoint) = 0;
+    virtual bool has_zonegroup_api(const std::string& api) const = 0;
+    virtual const string& get_current_period_id() = 0;
+};
+
 } } // namespace rgw::sal
 
 class RGWStoreManager {
index bf33ba3a8d3f41332ac7983012af12bf50d44e7a..8fec427ca42989ea0645cfe72329898b6d8389e3 100644 (file)
@@ -840,31 +840,6 @@ int RGWRadosStore::defer_gc(const DoutPrefixProvider *dpp, RGWObjectCtx *rctx, R
   return rados->defer_gc(dpp, rctx, bucket->get_info(), obj->get_obj(), y);
 }
 
-const RGWZoneGroup& RGWRadosStore::get_zonegroup()
-{
-  return svc()->zone->get_zonegroup();
-}
-
-int RGWRadosStore::get_zonegroup(const string& id, RGWZoneGroup& zonegroup)
-{
-  return svc()->zone->get_zonegroup(id, zonegroup);
-}
-
-const RGWZoneParams& RGWRadosStore::get_zone_params()
-{
-  return svc()->zone->get_zone_params();
-}
-
-const rgw_zone_id& RGWRadosStore::get_zone_id()
-{
-  return svc()->zone->zone_id();
-}
-
-const RGWRealm& RGWRadosStore::get_realm()
-{
-  return svc()->zone->get_realm();
-}
-
 int RGWRadosStore::cluster_stat(RGWClusterStat& stats)
 {
   rados_cluster_stat_t rados_stats;
@@ -1892,6 +1867,56 @@ RadosWriter::~RadosWriter()
   }
 }
 
+const RGWZoneGroup& RadosZone::get_zonegroup()
+{
+  return store->svc()->zone->get_zonegroup();
+}
+
+int RadosZone::get_zonegroup(const string& id, RGWZoneGroup& zonegroup)
+{
+  return store->svc()->zone->get_zonegroup(id, zonegroup);
+}
+
+const RGWZoneParams& RadosZone::get_params()
+{
+  return store->svc()->zone->get_zone_params();
+}
+
+const rgw_zone_id& RadosZone::get_id()
+{
+  return store->svc()->zone->zone_id();
+}
+
+const RGWRealm& RadosZone::get_realm()
+{
+  return store->svc()->zone->get_realm();
+}
+
+const std::string& RadosZone::get_name() const
+{
+  return store->svc()->zone->zone_name();
+}
+
+bool RadosZone::is_writeable()
+{
+  return store->svc()->zone->zone_is_writeable();
+}
+
+bool RadosZone::get_redirect_endpoint(std::string *endpoint)
+{
+  return store->svc()->zone->get_redirect_zone_endpoint(endpoint);
+}
+
+bool RadosZone::has_zonegroup_api(const std::string& api) const
+{
+  return store->svc()->zone->has_zonegroup_api(api);
+}
+
+const string& RadosZone::get_current_period_id()
+{
+  return store->svc()->zone->get_current_period_id();
+}
+
 } // namespace rgw::sal
 
 extern "C" {
index 01c012503b1f74ba09e2f84969b0a1319a5dae84..d5d5d5740327c8e42aad68773922cf304be7cb1d 100644 (file)
@@ -329,15 +329,35 @@ class RGWRadosBucket : public RGWBucket {
     friend class RGWRadosStore;
 };
 
+class RadosZone : public Zone {
+  protected:
+    RGWRadosStore* store;
+  public:
+    RadosZone(RGWRadosStore* _store) : store(_store) {}
+    ~RadosZone() = default;
+
+    virtual const RGWZoneGroup& get_zonegroup() override;
+    virtual int get_zonegroup(const string& id, RGWZoneGroup& zonegroup) override;
+    virtual const RGWZoneParams& get_params() override;
+    virtual const rgw_zone_id& get_id() override;
+    virtual const RGWRealm& get_realm() override;
+    virtual const std::string& get_name() const override;
+    virtual bool is_writeable() override;
+    virtual bool get_redirect_endpoint(string *endpoint) override;
+    virtual bool has_zonegroup_api(const std::string& api) const override;
+    virtual const string& get_current_period_id() override;
+};
+
 class RGWRadosStore : public RGWStore {
   private:
     RGWRados *rados;
     RGWUserCtl *user_ctl;
     std::string luarocks_path;
+    RadosZone zone;
 
   public:
     RGWRadosStore()
-      : rados(nullptr) {
+      : rados(nullptr), zone(this) {
       }
     ~RGWRadosStore() {
       delete rados;
@@ -373,11 +393,7 @@ class RGWRadosStore : public RGWStore {
                                          optional_yield y) override;
     virtual int defer_gc(const DoutPrefixProvider *dpp, RGWObjectCtx *rctx, RGWBucket* bucket, RGWObject* obj,
                         optional_yield y) override;
-    virtual const RGWZoneGroup& get_zonegroup() override;
-    virtual int get_zonegroup(const string& id, RGWZoneGroup& zonegroup) override;
-    virtual const RGWZoneParams& get_zone_params() override;
-    virtual const rgw_zone_id& get_zone_id() override;
-    virtual const RGWRealm& get_realm() override;
+    virtual Zone* get_zone() { return &zone; }
     virtual int cluster_stat(RGWClusterStat& stats) override;
     virtual std::unique_ptr<Lifecycle> get_lifecycle(void) override;
     virtual std::unique_ptr<Completions> get_completions(void) override;
index 440b9ae2ae98678924a7a9107ca0eb7660fc3326..6eaaab9ce4e7fd9a64663f57897d31d87b6f108f 100644 (file)
@@ -40,7 +40,7 @@ public:
     dest.arn_topic = topic_name;
     // the topic ARN will be sent in the reply
     const rgw::ARN arn(rgw::Partition::aws, rgw::Service::sns, 
-        store->get_zonegroup().get_name(),
+        store->get_zone()->get_zonegroup().get_name(),
         s->user->get_tenant(), topic_name);
     topic_arn = arn.to_string();
     return 0;
index c8a1a8f298adbf9a1b07ee03b33d1fed94522d8f..41d21c67525a842c3b87036e9f6d60aace3af7e2 100644 (file)
@@ -497,7 +497,7 @@ int RGWDataAccess::Object::put(bufferlist& data,
   CompressorRef plugin;
   boost::optional<RGWPutObj_Compress> compressor;
 
-  const auto& compression_type = store->get_zone_params().get_compression_type(bucket_info.placement_rule);
+  const auto& compression_type = store->get_zone()->get_params().get_compression_type(bucket_info.placement_rule);
   if (compression_type != "none") {
     plugin = Compressor::create(store->ctx(), compression_type);
     if (!plugin) {
index eb3b381c15d8a6fb25a1c48e2303349e3265aad9..736c1ac10dfa3431d1671a91ea80f2e619afab15 100644 (file)
@@ -1081,7 +1081,7 @@ class BucketTrimManager::Impl : public TrimCounters::Server,
 
   Impl(rgw::sal::RGWRadosStore *store, const BucketTrimConfig& config)
     : store(store), config(config),
-      status_obj(store->get_zone_params().log_pool, BucketTrimStatus::oid),
+      status_obj(store->get_zone()->get_params().log_pool, BucketTrimStatus::oid),
       counter(config.counter_size),
       trimmed(config.recent_size, config.recent_duration),
       watcher(store, status_obj, this)