From a55797e093a110a2c86556fc5957948510a6f3f1 Mon Sep 17 00:00:00 2001 From: lvshanchun Date: Tue, 27 Feb 2018 16:14:08 +0800 Subject: [PATCH] rgw: create sync-module instance when radosgw-admin sync run Signed-off-by: lvshanchun --- src/rgw/rgw_admin.cc | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc index 0e24d5a63547f..382b488e3db88 100644 --- a/src/rgw/rgw_admin.cc +++ b/src/rgw/rgw_admin.cc @@ -6480,17 +6480,9 @@ next: return EINVAL; } - 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); + RGWDataSyncStatusManager sync(store, store->get_async_rados(), source_zone); - ret = sync.init(); + int ret = sync.init(); if (ret < 0) { cerr << "ERROR: sync.init() returned ret=" << ret << std::endl; return -ret; @@ -6508,9 +6500,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; -- 2.39.5