]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
RGW Zipper - random cleanups
authorDaniel Gryniewicz <dang@redhat.com>
Thu, 21 Jan 2021 14:40:36 +0000 (09:40 -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>
src/rgw/rgw_data_sync.cc
src/rgw/rgw_main.cc
src/rgw/rgw_process.cc
src/rgw/rgw_rest_log.cc
src/rgw/rgw_rest_pubsub.cc
src/rgw/rgw_rest_realm.cc
src/rgw/rgw_sal.h
src/rgw/rgw_sal_rados.h
src/rgw/rgw_sync_module_es_rest.cc
src/rgw/rgw_sync_module_pubsub_rest.cc

index cb173b8e5faa4147fb664e2f1d16deb541eec10d..e6436043b9da7507b2a578bd9d9e08ecc331b5aa 100644 (file)
@@ -2644,7 +2644,7 @@ int RGWDataSyncStatusManager::init()
   const RGWZoneParams& zone_params = store->svc()->zone->get_zone_params();
 
   if (sync_module == nullptr) { 
-    sync_module = store->getRados()->get_sync_module();
+    sync_module = store->get_sync_module();
   }
 
   conn = store->svc()->zone->get_zone_conn(source_zone);
index b9fa385e946b590a55afad62b70c49b909d90a4b..36ac9f3115af2f4ac1a3d5bf87fd71ee7d0db10a 100644 (file)
@@ -163,7 +163,7 @@ static RGWRESTMgr *set_logging(RGWRESTMgr *mgr)
   return mgr;
 }
 
-static RGWRESTMgr *rest_filter(RGWRados *store, int dialect, RGWRESTMgr *orig)
+static RGWRESTMgr *rest_filter(rgw::sal::RGWStore* store, int dialect, RGWRESTMgr *orig)
 {
   RGWSyncModuleInstanceRef sync_module = store->get_sync_module();
   if (sync_module) {
@@ -387,7 +387,7 @@ int radosgw_Main(int argc, const char **argv)
   const bool swift_at_root = g_conf()->rgw_swift_url_prefix == "/";
   if (apis_map.count("s3") > 0 || s3website_enabled) {
     if (! swift_at_root) {
-      rest.register_default_mgr(set_logging(rest_filter(static_cast<rgw::sal::RGWRadosStore*>(store)->getRados(), RGW_REST_S3,
+      rest.register_default_mgr(set_logging(rest_filter(store, RGW_REST_S3,
                                                         new RGWRESTMgr_S3(s3website_enabled, sts_enabled, iam_enabled, pubsub_enabled))));
     } else {
       derr << "Cannot have the S3 or S3 Website enabled together with "
@@ -446,7 +446,7 @@ int radosgw_Main(int argc, const char **argv)
 
     if (! swift_at_root) {
       rest.register_resource(g_conf()->rgw_swift_url_prefix,
-                          set_logging(rest_filter(static_cast<rgw::sal::RGWRadosStore*>(store)->getRados(), RGW_REST_SWIFT,
+                          set_logging(rest_filter(store, RGW_REST_SWIFT,
                                                   swift_resource)));
     } else {
       if (store->get_zonegroup().zones.size() > 1) {
@@ -472,6 +472,7 @@ int radosgw_Main(int argc, const char **argv)
   
     /*Registering resource for /admin/metadata */
     admin_resource->register_resource("metadata", new RGWRESTMgr_Metadata);
+    /* XXX dang ifdef these RADOS ? */
     admin_resource->register_resource("log", new RGWRESTMgr_Log);
     admin_resource->register_resource("config", new RGWRESTMgr_Config);
     admin_resource->register_resource("realm", new RGWRESTMgr_Realm);
index 6800ff0e5e04926d21b2d1b2eff99a45b24d53da..87b62fd9619dafbd03da6a357c006e8b932e4ce3 100644 (file)
@@ -209,7 +209,7 @@ int process_request(rgw::sal::RGWStore* const store,
 
   s->req_id = static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone_utils->unique_id(req->id);
   s->trans_id = static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone_utils->unique_trans_id(req->id);
-  s->host_id = static_cast<rgw::sal::RGWRadosStore*>(store)->getRados()->host_id;
+  s->host_id = store->get_host_id();
   s->yield = yield;
 
   ldpp_dout(s, 2) << "initializing for trans_id = " << s->trans_id << dendl;
index 2a6b59b29dd7999e901a1c5cd13c2e55e1c96fc3..bf1224cb7d672f330b7b499dcbdf6b52b50be1a6 100644 (file)
@@ -847,7 +847,7 @@ void RGWOp_BILog_Status::execute(optional_yield y)
     }
   }
 
-  const auto& local_zone_id = static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone->zone_id();
+  const auto& local_zone_id = store->get_zone_id();
 
   if (!merge) {
     rgw_sync_bucket_pipe pipe;
index ce59a39298fae64c97387728bf2a5cfeae08a95a..e05bedadf04cf76de2c21ea81b9865f766268c13 100644 (file)
@@ -498,8 +498,8 @@ void RGWPSCreateNotif_ObjStore_S3::execute(optional_yield y) {
   std::string data_bucket_prefix = "";
   std::string data_oid_prefix = "";
   bool push_only = true;
-  if (static_cast<rgw::sal::RGWRadosStore*>(store)->getRados()->get_sync_module()) {
-    const auto psmodule = dynamic_cast<RGWPSSyncModuleInstance*>(static_cast<rgw::sal::RGWRadosStore*>(store)->getRados()->get_sync_module().get());
+  if (store->get_sync_module()) {
+    const auto psmodule = dynamic_cast<RGWPSSyncModuleInstance*>(store->get_sync_module().get());
     if (psmodule) {
       const auto& conf = psmodule->get_effective_conf();
       data_bucket_prefix = conf["data_bucket_prefix"];
index b48999c3826a231149f3cc2ab0d663dd6cbef910..b128c9b9ac90633a5a52d9d4c72883ec92a35295 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() != static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone->get_realm().get_id()) {
+  if (period.get_realm() != store->get_realm().get_id()) {
     error_stream << "period with realm id " << period.get_realm()
-        << " doesn't match current realm " << static_cast<rgw::sal::RGWRadosStore*>(store)->svc()->zone->get_realm().get_id() << std::endl;
+        << " doesn't match current realm " << store->get_realm().get_id() << std::endl;
     op_ret = -EINVAL;
     return;
   }
index b069487cd99b4bb2b409b38022d834ff6ac828db..4a244e0bbd975018ccbd48a2fb91be5b7902e5df 100644 (file)
@@ -35,6 +35,8 @@ class RGWListRawObjsCtx;
 class RGWBucketSyncPolicyHandler;
 using RGWBucketSyncPolicyHandlerRef = std::shared_ptr<RGWBucketSyncPolicyHandler>;
 class RGWDataSyncStatusManager;
+class RGWSyncModuleInstance;
+typedef std::shared_ptr<RGWSyncModuleInstance> RGWSyncModuleInstanceRef;
 namespace rgw {
   class Aio;
   namespace IAM { struct Policy; }
@@ -222,6 +224,8 @@ class RGWStore {
     virtual void meta_list_keys_complete(void* handle) = 0;
     virtual std::string meta_get_marker(void *handle) = 0;
     virtual int meta_remove(const DoutPrefixProvider *dpp, string& metadata_key, optional_yield y) = 0;
+    virtual const RGWSyncModuleInstanceRef& get_sync_module() = 0;
+    virtual std::string get_host_id() = 0;
 
     virtual void finalize(void) = 0;
 
index e5f25ddd8a0d3b5cd515fc19d88864d72da962b5..01c012503b1f74ba09e2f84969b0a1319a5dae84 100644 (file)
@@ -438,6 +438,8 @@ class RGWRadosStore : public RGWStore {
     virtual void meta_list_keys_complete(void* handle) override;
     virtual std::string meta_get_marker(void *handle) override;
     virtual int meta_remove(const DoutPrefixProvider *dpp, string& metadata_key, optional_yield y) override;
+    virtual const RGWSyncModuleInstanceRef& get_sync_module() { return rados->get_sync_module(); }
+    virtual std::string get_host_id() { return rados->host_id; }
 
     virtual void finalize(void) override;
 
index 61a16904e5e16f20158ae8421aa728d3f9669f33..280fbd6a673f08edd9e810de0393ceb350cf2409 100644 (file)
@@ -381,7 +381,7 @@ class RGWHandler_REST_MDSearch_S3 : public RGWHandler_REST_S3 {
 protected:
   RGWOp *op_get() override {
     if (s->info.args.exists("query")) {
-      return new RGWMetadataSearch_ObjStore_S3(static_cast<rgw::sal::RGWRadosStore*>(store)->getRados()->get_sync_module());
+      return new RGWMetadataSearch_ObjStore_S3(store->get_sync_module());
     }
     if (!s->init_state.url_bucket.empty() &&
         s->info.args.exists("mdsearch")) {
index 5acec0a9de8accce4a77f3da21538b30baf07573..440b9ae2ae98678924a7a9107ca0eb7660fc3326 100644 (file)
@@ -171,7 +171,7 @@ public:
       return -EINVAL;
     }
 
-    const auto psmodule = static_cast<RGWPSSyncModuleInstance*>(static_cast<rgw::sal::RGWRadosStore*>(store)->getRados()->get_sync_module().get());
+    const auto psmodule = static_cast<RGWPSSyncModuleInstance*>(store->get_sync_module().get());
     const auto& conf = psmodule->get_effective_conf();
 
     dest.push_endpoint = s->info.args.get("push-endpoint");