From fb2b8f2fc4eead1986778a6c04f1f12d196012b2 Mon Sep 17 00:00:00 2001 From: Orit Wasserman Date: Mon, 19 Oct 2015 12:28:19 +0200 Subject: [PATCH] rgw: update rest connections from the current period Signed-off-by: Orit Wasserman --- src/rgw/rgw_rados.cc | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index 3b0c1e797b477..a2ebe3c8b4dd1 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -2947,7 +2947,8 @@ fail: * @param zonegroup zonegroup which new connection will connect to * @param new_connection pointer to new connection instance */ -static void add_new_connection_to_map(map &zonegroup_conn_map, RGWZoneGroup &zonegroup, RGWRESTConn *new_connection) +static void add_new_connection_to_map(map &zonegroup_conn_map, + const RGWZoneGroup &zonegroup, RGWRESTConn *new_connection) { // Delete if connection is already exists map::iterator iterZoneGroup = zonegroup_conn_map.find(zonegroup.get_id()); @@ -3071,7 +3072,6 @@ int RGWRados::init_complete() lderr(cct) << "failed reading current period info: " << " " << cpp_strerror(-ret) << dendl; return ret; } else { - map::const_iterator iter = current_period.get_map().zonegroups.find(zonegroup.get_predefined_name(cct)); if (iter != current_period.get_map().zonegroups.end()) { @@ -3090,6 +3090,16 @@ int RGWRados::init_complete() lderr(cct) << "Cannot find zonegroup" << zonegroup.get_predefined_name(cct) << " in current period using local" << dendl; } + + for (iter = current_period.get_map().zonegroups.begin(); + iter != current_period.get_map().zonegroups.end(); ++iter){ + const RGWZoneGroup& zonegroup = iter->second; + add_new_connection_to_map(zonegroup_conn_map, zonegroup, new RGWRESTConn(cct, this, zonegroup.endpoints)); + if (!current_period.get_master_zonegroup().empty() && + zonegroup.get_id() == current_period.get_master_zonegroup()) { + rest_master_conn = new RGWRESTConn(cct, this, zonegroup.endpoints); + } + } } } -- 2.39.5