]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: get_zonegroup() uses "default" zonegroup if empty 11863/head
authorYehuda Sadeh <yehuda@redhat.com>
Thu, 22 Sep 2016 23:03:15 +0000 (16:03 -0700)
committerLoic Dachary <ldachary@redhat.com>
Wed, 9 Nov 2016 14:19:54 +0000 (15:19 +0100)
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>
(cherry picked from commit 3d7169af3f5eeb6bc8a89ee873ec43f57f206f3a)

src/rgw/rgw_rados.cc

index 3f348502d127b50dd3ff7ff990daa99fb920473f..4cf8a918bb507a7a5019e904acd65ef66148bf62 100644 (file)
@@ -902,7 +902,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;