]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: create sync-module instance when execute radosgw-admin data sync run
authorlvshanchun <lvshanchun@gmail.com>
Tue, 19 Dec 2017 02:53:06 +0000 (10:53 +0800)
committerPrashant D <pdhange@redhat.com>
Wed, 7 Mar 2018 00:29:49 +0000 (19:29 -0500)
Signed-off-by: lvshanchun <lvshanchun@gmail.com>
(cherry picked from commit 416cdfc76b72115a316ed4803ac2ce37830b6295)

src/rgw/rgw_admin.cc
src/rgw/rgw_data_sync.cc
src/rgw/rgw_data_sync.h

index 141f3df32490de23674cc4c668b873b6668f7ab6..c40e18aaa998a21763cc4732c65fdf81d44b731c 100644 (file)
@@ -6422,9 +6422,18 @@ next:
       cerr << "ERROR: source zone not specified" << std::endl;
       return EINVAL;
     }
-    RGWDataSyncStatusManager sync(store, store->get_async_rados(), source_zone);
 
-    int ret = sync.init();
+    RGWSyncModuleInstanceRef sync_module;
+    int ret = store->get_sync_modules_manager()->create_instance(g_ceph_context, store->get_zone().tier_type, 
+        store->get_zone_params().tier_config, &sync_module);
+    if (ret < 0) {
+      lderr(cct) << "ERROR: failed to init sync module instance, ret=" << ret << dendl;
+      return ret;
+    }
+
+    RGWDataSyncStatusManager sync(store, store->get_async_rados(), source_zone, sync_module);
+
+    ret = sync.init();
     if (ret < 0) {
       cerr << "ERROR: sync.init() returned ret=" << ret << std::endl;
       return -ret;
index c58a650bdf8e56163e043277c0641c8640217bac..eabef031b067cfde366afa604ad51897ca81977f 100644 (file)
@@ -1683,7 +1683,9 @@ int RGWDataSyncStatusManager::init()
 
   RGWZoneParams& zone_params = store->get_zone_params();
 
-  sync_module = store->get_sync_module();
+  if (sync_module == nullptr) { 
+    sync_module = store->get_sync_module();
+  }
 
   conn = store->get_zone_conn_by_id(source_zone);
   if (!conn) {
index 7716fabadcc6e57468b5b4ae11d878d9ce626f19..8e876b9c97d77a0c66f026414fb686b7ecf79fd1 100644 (file)
@@ -305,6 +305,12 @@ public:
     : store(_store), source_zone(_source_zone), conn(NULL), error_logger(NULL),
       sync_module(nullptr),
       source_log(store, async_rados, observer), num_shards(0) {}
+  RGWDataSyncStatusManager(RGWRados *_store, RGWAsyncRadosProcessor *async_rados,
+                           const string& _source_zone, const RGWSyncModuleInstanceRef& _sync_module,
+                           rgw::BucketChangeObserver *observer = nullptr)
+    : store(_store), source_zone(_source_zone), conn(NULL), error_logger(NULL),
+      sync_module(_sync_module),
+      source_log(store, async_rados, observer), num_shards(0) {}
   ~RGWDataSyncStatusManager() {
     finalize();
   }