From 0e4cdb651a83334071e3691e346b94ee4e46bc82 Mon Sep 17 00:00:00 2001 From: Orit Wasserman Date: Tue, 22 Sep 2015 21:55:38 +0200 Subject: [PATCH] radosgw-admin: update zonegroupmap when adding a zone Signed-off-by: Orit Wasserman --- src/rgw/rgw_admin.cc | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc index 5c9f4680f4d9f..40e8d9054f22c 100644 --- a/src/rgw/rgw_admin.cc +++ b/src/rgw/rgw_admin.cc @@ -2405,6 +2405,30 @@ int main(int argc, char **argv) << cpp_strerror(-ret) << std::endl; return ret; } + + RGWRealm realm(realm_id, realm_name); + ret = realm.init(g_ceph_context, store); + if (ret < 0) { + cerr << "ERROR: couldn't init realm:" << 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(g_ceph_context, store, realm, zonegroup); + if (ret < 0) { + cerr << "failed to update zonegroup_map: " << cpp_strerror(-ret) << std::endl; + return -ret; + } + ret = zonegroup_map.store(g_ceph_context, store); + if (ret < 0) { + cerr << "failed to store zonegroup_map: " << cpp_strerror(-ret) << std::endl; + return -ret; + } } break; case OPT_ZONE_CREATE: @@ -2437,6 +2461,7 @@ int main(int argc, char **argv) return ret; } } + encode_json("zone", zone, formatter); formatter->flush(cout); cout << std::endl; -- 2.39.5