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: fix for unsafe change of rgw_zonegroup #12075

Merged
merged 1 commit into from Dec 2, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/rgw/rgw_admin.cc
Expand Up @@ -2245,6 +2245,12 @@ int main(int argc, char **argv)

auto cct = global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT,
CODE_ENVIRONMENT_UTILITY, 0);

// for region -> zonegroup conversion (must happen before common_init_finish())
if (!g_conf->rgw_region.empty() && g_conf->rgw_zonegroup.empty()) {
g_conf->set_val_or_die("rgw_zonegroup", g_conf->rgw_region.c_str());
}

common_init_finish(g_ceph_context);

rgw_user user_id;
Expand Down
5 changes: 5 additions & 0 deletions src/rgw/rgw_main.cc
Expand Up @@ -284,6 +284,11 @@ int main(int argc, const char **argv)
}
}

// for region -> zonegroup conversion (must happen before common_init_finish())
if (!g_conf->rgw_region.empty() && g_conf->rgw_zonegroup.empty()) {
g_conf->set_val_or_die("rgw_zonegroup", g_conf->rgw_region.c_str());
}

check_curl();

if (g_conf->daemonize) {
Expand Down
8 changes: 0 additions & 8 deletions src/rgw/rgw_rados.cc
Expand Up @@ -3411,14 +3411,6 @@ int RGWRados::convert_regionmap()
*/
int RGWRados::replace_region_with_zonegroup()
{
if (!cct->_conf->rgw_region.empty() && cct->_conf->rgw_zonegroup.empty()) {
int ret = cct->_conf->set_val("rgw_zonegroup", cct->_conf->rgw_region, true, false);
if (ret < 0) {
ldout(cct, 0) << "failed to set rgw_zonegroup to " << cct->_conf->rgw_region << dendl;
return ret;
}
}

/* copy default region */
/* convert default region to default zonegroup */
string default_oid = cct->_conf->rgw_default_region_info_oid;
Expand Down