From 265e09338444c95a472355a2a4e2a91a51b53152 Mon Sep 17 00:00:00 2001 From: Orit Wasserman Date: Wed, 23 Sep 2015 12:46:05 +0200 Subject: [PATCH] radosgw-admin: update zonegroupmap when activating a period Signed-off-by: Orit Wasserman --- src/rgw/rgw_admin.cc | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc index 87246521567f5..c24b8bfdf27ec 100644 --- a/src/rgw/rgw_admin.cc +++ b/src/rgw/rgw_admin.cc @@ -1898,12 +1898,33 @@ int main(int argc, char **argv) cerr << "Error initing realm " << cpp_strerror(-ret) << std::endl; return ret; } - cerr << "realm id " << realm.get_id() << " name " << realm.get_name() << std::endl; ret = realm.set_current_period(period_id); if (ret < 0 ) { cerr << "Error setting current period " << period_id << ":" << cpp_strerror(-ret) << std::endl; return ret; } + RGWZoneGroupMap zonegroup_map; + ret = zonegroup_map.read(g_ceph_context, store); + if (ret < 0 && ret != -ENOENT) { + cerr << "ERROR: couldn't read zonegroup_map: " << cpp_strerror(-ret) << std::endl; + return ret; + } + ret = zonegroup_map.update(realm); + if (ret < 0) { + cerr << "ERROR: couldn't update realm " << realm_name << ": " << cpp_strerror(-ret) << std::endl; + return ret; + } + ret = zonegroup_map.update(g_ceph_context, store, realm.get_current_period(), realm.get_id()); + if (ret < 0) { + cerr << "ERROR: couldn't update " << realm_name << " current period: " << cpp_strerror(-ret) + << std::endl; + return ret; + } + ret = zonegroup_map.store(g_ceph_context, store); + if (ret < 0) { + cerr << "ERROR: couldn't store zonegroup map info: " << cpp_strerror(-ret) << std::endl; + return 1; + } } break; case OPT_PERIOD_LIST: -- 2.39.5