]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: RGWPeriod::reflect() sets master zonegroup as default 8566/head
authorCasey Bodley <cbodley@redhat.com>
Tue, 12 Apr 2016 20:21:13 +0000 (16:21 -0400)
committerCasey Bodley <cbodley@redhat.com>
Wed, 13 Apr 2016 14:44:17 +0000 (10:44 -0400)
if RGWPeriod::reflect() is called right after a 'realm pull', it will
create the zonegroup objects but not set any as default.  so the next
time RGWRados is initialized, create_defaults() will add a new 'default'
zonegroup and set it as the master.  this causes a 'period update' to
find multiple master zonegroups and fail with EINVAL

reflect() now calls set_as_default(exclusive=true) on the master
zonegroup to guarantee that a default is set

Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/rgw/rgw_rados.cc

index c02b153f28e78d0702630fafa64f3ccb9823a9df..5a684409af97fdf2c9c3d0162c34950b91baee91 100644 (file)
@@ -1204,6 +1204,14 @@ int RGWPeriod::reflect()
       ldout(cct, 0) << "ERROR: failed to store zonegroup info for zonegroup=" << iter.first << ": " << cpp_strerror(-r) << dendl;
       return r;
     }
+    if (zg.is_master_zonegroup()) {
+      // set master as default if no default exists
+      r = zg.set_as_default(true);
+      if (r == 0) {
+        ldout(cct, 1) << "Set the period's master zonegroup " << zg.get_id()
+            << " as the default" << dendl;
+      }
+    }
   }
   return 0;
 }