]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: update rest connections from the current period
authorOrit Wasserman <owasserm@redhat.com>
Mon, 19 Oct 2015 10:28:19 +0000 (12:28 +0200)
committerYehuda Sadeh <yehuda@redhat.com>
Fri, 12 Feb 2016 00:13:16 +0000 (16:13 -0800)
Signed-off-by: Orit Wasserman <owasserm@redhat.com>
src/rgw/rgw_rados.cc

index 3b0c1e797b4774b734670a7160fd466fbd550912..a2ebe3c8b4dd1c9faf6fa12a3207ba553bdc655e 100644 (file)
@@ -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<string, RGWRESTConn *> &zonegroup_conn_map, RGWZoneGroup &zonegroup, RGWRESTConn *new_connection)
+static void add_new_connection_to_map(map<string, RGWRESTConn *> &zonegroup_conn_map,
+                                     const RGWZoneGroup &zonegroup, RGWRESTConn *new_connection)
 {
   // Delete if connection is already exists
   map<string, RGWRESTConn *>::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<string, RGWZoneGroup>::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);
+       }
+      }
     }
   }