Skip to content

Commit

Permalink
Merge pull request #10659: jewel: use zone endpoints instead of zoneg…
Browse files Browse the repository at this point in the history
…roup endpoints

Reviewed-by: Loic Dachary <ldachary@redhat.com>
  • Loading branch information
Loic Dachary committed Aug 24, 2016
2 parents 3792ab8 + fa2e42d commit 82e277f
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions src/rgw/rgw_rados.cc
Expand Up @@ -3514,10 +3514,18 @@ int RGWRados::init_zg_from_period(bool *initialized)
for (iter = current_period.get_map().zonegroups.begin();
iter != current_period.get_map().zonegroups.end(); ++iter){
const RGWZoneGroup& zg = iter->second;
add_new_connection_to_map(zonegroup_conn_map, zg, new RGWRESTConn(cct, this, zg.get_id(), zg.endpoints));
// use endpoints from the zonegroup's master zone
auto master = zg.zones.find(zg.master_zone);
if (master == zg.zones.end()) {
ldout(cct, 0) << "zonegroup " << zg.get_name() << " missing zone for "
"master_zone=" << zg.master_zone << dendl;
return -EINVAL;
}
const auto& endpoints = master->second.endpoints;
add_new_connection_to_map(zonegroup_conn_map, zg, new RGWRESTConn(cct, this, zg.get_id(), endpoints));
if (!current_period.get_master_zonegroup().empty() &&
zg.get_id() == current_period.get_master_zonegroup()) {
rest_master_conn = new RGWRESTConn(cct, this, zg.get_id(), zg.endpoints);
rest_master_conn = new RGWRESTConn(cct, this, zg.get_id(), endpoints);
}
}

Expand Down Expand Up @@ -3550,7 +3558,15 @@ int RGWRados::init_zg_from_local(bool *creating_defaults)
}
ldout(cct, 20) << "zonegroup " << zonegroup.get_name() << dendl;
if (zonegroup.is_master) {
rest_master_conn = new RGWRESTConn(cct, this, zonegroup.get_id(), zonegroup.endpoints);
// use endpoints from the zonegroup's master zone
auto master = zonegroup.zones.find(zonegroup.master_zone);
if (master == zonegroup.zones.end()) {
ldout(cct, 0) << "zonegroup " << zonegroup.get_name() << " missing zone for "
"master_zone=" << zonegroup.master_zone << dendl;
return -EINVAL;
}
const auto& endpoints = master->second.endpoints;
rest_master_conn = new RGWRESTConn(cct, this, zonegroup.get_id(), endpoints);
}

return 0;
Expand Down

0 comments on commit 82e277f

Please sign in to comment.