Skip to content

Commit

Permalink
rgw: RGWPeriod::reflect() sets first zonegroup as default
Browse files Browse the repository at this point in the history
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 each zonegroup to
guarantee that the first zonegroup is made default if no default is set

Signed-off-by: Casey Bodley <cbodley@redhat.com>
  • Loading branch information
cbodley committed Apr 12, 2016
1 parent 4a0baee commit 75d35f1
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/rgw/rgw_rados.cc
Expand Up @@ -1204,6 +1204,8 @@ int RGWPeriod::reflect()
ldout(cct, 0) << "ERROR: failed to store zonegroup info for zonegroup=" << iter.first << ": " << cpp_strerror(-r) << dendl;
return r;
}
// set as default if no default exists
zg.set_as_default(true);
}
return 0;
}
Expand Down

0 comments on commit 75d35f1

Please sign in to comment.