Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rgw: RGWPeriod::reflect() sets master zonegroup as default #8566

Merged
merged 1 commit into from Apr 14, 2016

Conversation

cbodley
Copy link
Contributor

@cbodley cbodley commented Apr 12, 2016

This patch improves the configuration of a secondary cluster by establishing a default zonegroup after the initial 'realm pull'.

Previously, the initial output of 'zonegroup list' was:

read_default_id : -2
{
    "default_info": "",
    "zonegroups": [
        "us",
        "default"
    ]
}

With these patches, the output is as expected:

read_default_id : 0
{
    "default_info": "792474ac-d2f1-4a29-9c48-ce2dd1f116cf",
    "zonegroups": [
        "us"
    ]
}

@cbodley cbodley added this to the jewel milestone Apr 12, 2016
@cbodley cbodley changed the title rgw: 'period pull' writes local zonegroup objects rgw: RGWPeriod::reflect() sets first zonegroup as default Apr 12, 2016
@@ -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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is better to set the master zonegroup as default and not the first.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure. i think i'll also add a ldout message if it successfully changes the 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 <cbodley@redhat.com>
@cbodley cbodley changed the title rgw: RGWPeriod::reflect() sets first zonegroup as default rgw: RGWPeriod::reflect() sets master zonegroup as default Apr 13, 2016
@cbodley
Copy link
Contributor Author

cbodley commented Apr 13, 2016

@oritwas updated to only call set_as_default() on master zg

@oritwas oritwas merged commit 6e2667a into ceph:master Apr 14, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants