Merge pull request #18898 from Leeshine/wip-rgw-bug-22080

rgw: create sync-module instance when execute radosgw-admin data sync run

Reviewed-by: Orit Wasserman <owasserm@redhat.com>
This commit is contained in:
Casey Bodley 2017-12-19 17:26:18 -05:00 committed by GitHub
commit de57814fbf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 3 deletions

View File

@ -6470,9 +6470,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;

View File

@ -1775,7 +1775,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) {

View File

@ -311,6 +311,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();
}