From: Casey Bodley Date: Tue, 12 Apr 2016 20:21:13 +0000 (-0400) Subject: rgw: RGWPeriod::reflect() sets master zonegroup as default X-Git-Tag: v10.2.0~34^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F8566%2Fhead;p=ceph.git rgw: RGWPeriod::reflect() sets master zonegroup as default 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 --- diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index c02b153f28e7..5a684409af97 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -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; }