]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: define sync_module on RGWRados
authorYehuda Sadeh <yehuda@redhat.com>
Wed, 3 Aug 2016 18:22:00 +0000 (11:22 -0700)
committerYehuda Sadeh <yehuda@redhat.com>
Fri, 7 Oct 2016 17:31:17 +0000 (10:31 -0700)
Instead of having it as part of the data sync module. Since we only have a
single sync_module, having it there will make it easier to get its properties.

Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/rgw/rgw_data_sync.cc
src/rgw/rgw_rados.cc
src/rgw/rgw_rados.h

index b93922413f78fdddf94e66ed06bedb9b13a8d28d..0be2bd44a7b07bca8265198508498acaa3be7d28 100644 (file)
@@ -1611,12 +1611,7 @@ int RGWDataSyncStatusManager::init()
 
   RGWZoneParams& zone_params = store->get_zone_params();
 
-  int r = store->get_sync_modules_manager()->create_instance(zone_def.tier_type, zone_params.tier_config, &sync_module);
-  if (r < 0) {
-    lderr(store->ctx()) << "ERROR: failed to init sync module instance, r=" << r << dendl;
-    finalize();
-    return r;
-  }
+  sync_module = store->get_sync_module();
 
   conn = store->get_zone_conn_by_id(source_zone);
   if (!conn) {
@@ -1626,7 +1621,7 @@ int RGWDataSyncStatusManager::init()
 
   const char *log_pool = zone_params.log_pool.name.c_str();
   librados::Rados *rados = store->get_rados_handle();
-  r = rados->ioctx_create(log_pool, ioctx);
+  int r = rados->ioctx_create(log_pool, ioctx);
   if (r < 0) {
     lderr(store->ctx()) << "ERROR: failed to open log pool (" << zone_params.log_pool.name << " ret=" << r << dendl;
     return r;
index 84b63bd0e87ae56222b3ed83929e910f99c93f7f..58d7edbc0801c98fa1dee15cbb562146c723e962 100644 (file)
@@ -3792,6 +3792,12 @@ int RGWRados::init_complete()
 
   zone_short_id = current_period.get_map().get_zone_short_id(zone_params.get_id());
 
+  ret = sync_modules_manager->create_instance(zone_public_config.tier_type, zone_params.tier_config, &sync_module);
+  if (ret < 0) {
+    lderr(cct) << "ERROR: failed to init sync module instance, ret=" << ret << dendl;
+    return ret;
+  }
+
   init_unique_trans_id_deps();
 
   finisher = new Finisher(cct);
index 209269332cf4429c6aa99aadd387fcde95c06f0a..5c42ca02ca376874e9f57912887e5391a37a4b5e 100644 (file)
@@ -1902,6 +1902,7 @@ protected:
   RGWCoroutinesManagerRegistry *cr_registry;
 
   RGWSyncModulesManager *sync_modules_manager{nullptr};
+  RGWSyncModuleInstanceRef sync_module;
 
   RGWZoneGroup zonegroup;
   RGWZone zone_public_config; /* external zone params, e.g., entrypoints, log flags, etc. */  
@@ -2047,6 +2048,9 @@ public:
   RGWSyncModulesManager *get_sync_modules_manager() {
     return sync_modules_manager;
   }
+  const RGWSyncModuleInstanceRef& get_sync_module() {
+    return sync_module;
+  }
   int get_required_alignment(rgw_bucket& bucket, uint64_t *alignment);
   int get_max_chunk_size(rgw_bucket& bucket, uint64_t *max_chunk_size);