Skip to content

Commit

Permalink
Merge pull request #10368 from oritwas/wip-rgw-upgrade-period-commit
Browse files Browse the repository at this point in the history
rgw: fix upgrade from old multisite to new multisite configuration

Reviewed-by: Casey Bodley <cbodley@redhat.com>
  • Loading branch information
cbodley committed Jul 20, 2016
2 parents 31b2f48 + 6d7841c commit d21a3cd
Showing 1 changed file with 28 additions and 6 deletions.
34 changes: 28 additions & 6 deletions src/rgw/rgw_rados.cc
Expand Up @@ -3461,6 +3461,7 @@ int RGWRados::replace_region_with_zonegroup()
iter ++) {
RGWZoneParams zoneparams(iter->first, iter->first);
zoneparams.set_id(iter->first);
zoneparams.realm_id = realm.get_id();
ret = zoneparams.init(cct, this);
if (ret < 0) {
ldout(cct, 0) << "failed to init zoneparams " << iter->first << ": " << cpp_strerror(-ret) << dendl;
Expand Down Expand Up @@ -3488,16 +3489,37 @@ int RGWRados::replace_region_with_zonegroup()
ldout(cct, 0) << "failed to add zonegroup to current_period: " << cpp_strerror(-ret) << dendl;
return ret;
}
ret = current_period.update();
if (ret < 0) {
ldout(cct, 0) << "failed to update current_period: " << cpp_strerror(-ret) << dendl;
return ret;
}
}
}

if (!current_period.get_id().empty()) {
ret = current_period.update();
if (ret < 0) {
ldout(cct, 0) << "failed to update new period: " << cpp_strerror(-ret) << dendl;
return ret;
}
ret = current_period.store_info(false);
if (ret < 0) {
ldout(cct, 0) << "failed to store new period: " << cpp_strerror(-ret) << dendl;
return ret;
}
ret = current_period.reflect();
if (ret < 0) {
ldout(cct, 0) << "failed to update local objects: " << cpp_strerror(-ret) << dendl;
return ret;
}
}

for (auto const& iter : regions) {
RGWZoneGroup zonegroup(iter);
int ret = zonegroup.init(cct, this, true, true);
if (ret < 0) {
ldout(cct, 0) << "failed init zonegroup" << iter << ": ret "<< ret << " " << cpp_strerror(-ret) << dendl;
return ret;
}
ret = zonegroup.delete_obj(true);
if (ret < 0 && ret != -ENOENT) {
ldout(cct, 0) << "failed to delete region " << *iter << ": ret "<< ret << " " << cpp_strerror(-ret)
ldout(cct, 0) << "failed to delete region " << iter << ": ret "<< ret << " " << cpp_strerror(-ret)
<< dendl;
return ret;
}
Expand Down

0 comments on commit d21a3cd

Please sign in to comment.