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>
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;
}