]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rgw: get_zonegroup() uses "default" zonegroup if empty
authorYehuda Sadeh <yehuda@redhat.com>
Thu, 22 Sep 2016 23:03:15 +0000 (16:03 -0700)
committerYehuda Sadeh <yehuda@redhat.com>
Thu, 22 Sep 2016 23:03:15 +0000 (16:03 -0700)
Fixes: http://tracker.ceph.com/issues/17372
An empty zonegroup should be replaced with the "default" zonegroup.
This is needed when dealing with zonegroup set in old bucket info,
that predated setting the buckets' region.

Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/rgw/rgw_rados.cc

index b2a7d56330bbe1f26f52d72d52983889caafb10f..a04bbfe9c526144a804fd2612c3f4708232adc80 100644 (file)
@@ -923,7 +923,12 @@ int RGWPeriod::init(CephContext *_cct, RGWRados *_store, bool setup_obj)
 
 
 int RGWPeriod::get_zonegroup(RGWZoneGroup& zonegroup, const string& zonegroup_id) {
-  map<string, RGWZoneGroup>::const_iterator iter = period_map.zonegroups.find(zonegroup_id);
+  map<string, RGWZoneGroup>::const_iterator iter;
+  if (!zonegroup_id.empty()) {
+    iter = period_map.zonegroups.find(zonegroup_id);
+  } else {
+    iter = period_map.zonegroups.find("default");
+  }
   if (iter != period_map.zonegroups.end()) {
     zonegroup = iter->second;
     return 0;