string err;
long long tmp = 0;
- string source_zone;
+ string source_zone_name;
+ string source_zone; /* zone id */
for (std::vector<const char*>::iterator i = args.begin(); i != args.end(); ) {
if (ceph_argparse_double_dash(args, i)) {
list<string>::iterator iter;
get_str_list(val, endpoints);
} else if (ceph_argparse_witharg(args, i, &val, "--source-zone", (char*)NULL)) {
- source_zone = val;
+ source_zone_name = val;
} else if (strncmp(*i, "-", 1) == 0) {
cerr << "ERROR: invalid flag " << *i << std::endl;
return EINVAL;
return 5; //EIO
}
+ if (!source_zone_name.empty()) {
+ if (!store->find_zone_id_by_name(source_zone_name, &source_zone)) {
+ cerr << "WARNING: cannot find source zone id for name=" << source_zone_name << std::endl;
+ source_zone = source_zone_name;
+ }
+ }
+
rgw_user_init(store);
rgw_bucket_init(store->meta_mgr);
return 0;
}
+ source_zone = _source_zone;
+
CephContext *cct = store->ctx();
async_rados = new RGWAsyncRadosProcessor(store, cct->_conf->rgw_num_async_rados_threads);
async_rados->start();
conn = _conn;
- source_zone = _source_zone;
int ret = http_manager.set_threaded();
if (ret < 0) {
int RGWDataSyncStatusManager::init()
{
- conn = store->get_zone_conn_by_name(source_zone);
+ conn = store->get_zone_conn_by_id(source_zone);
if (!conn) {
ldout(store->ctx(), 0) << "connection object to zone " << source_zone << " does not exist" << dendl;
return -EINVAL;
int RGWBucketSyncStatusManager::init()
{
- conn = store->get_zone_conn_by_name(source_zone);
+ conn = store->get_zone_conn_by_id(source_zone);
if (!conn) {
ldout(store->ctx(), 0) << "connection object to zone " << source_zone << " does not exist" << dendl;
return -EINVAL;
Mutex::Locker dl(data_sync_thread_lock);
for (map<string, RGWRESTConn *>::iterator iter = zone_conn_map.begin(); iter != zone_conn_map.end(); ++iter) {
+ ldout(cct, 5) << "starting data sync thread for zone " << iter->first << dendl;
RGWDataSyncProcessorThread *thread = new RGWDataSyncProcessorThread(this, iter->first);
ret = thread->init();
if (ret < 0) {
return get_zone_conn_by_id(i->second);
}
+ bool find_zone_id_by_name(const string& name, string *id) {
+ auto i = zone_id_by_name.find(name);
+ if (i == zone_id_by_name.end()) {
+ return false;
+ }
+ *id = i->second;
+ return true;
+ }
+
int get_zonegroup(const string& id, RGWZoneGroup& zonegroup) {
int ret = 0;
if (id == get_zonegroup().get_id()) {