Skip to content

Commit

Permalink
Merge pull request #12075 from ceph/wip-rgw-zonegroup-config
Browse files Browse the repository at this point in the history
rgw: fix for unsafe change of rgw_zonegroup

Reviewed-by: Yehuda Sadeh <yehuda@redhat.com>
  • Loading branch information
yehudasa committed Dec 2, 2016
2 parents 98709d9 + ae3deda commit d009a6c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
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

0 comments on commit d009a6c

Please sign in to comment.