From 2441b7cd36ff80d58754bdbb0773302aaae8ec5a Mon Sep 17 00:00:00 2001 From: Orit Wasserman Date: Tue, 20 Oct 2015 10:19:02 +0200 Subject: [PATCH] rgw: add support to zonegroupmap set Signed-off-by: Orit Wasserman --- src/rgw/rgw_admin.cc | 11 ++++++++++- src/rgw/rgw_rados.cc | 13 +++++++++++++ src/rgw/rgw_rados.h | 2 ++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc index c0fd0316aa936..fb865aa0b00e5 100644 --- a/src/rgw/rgw_admin.cc +++ b/src/rgw/rgw_admin.cc @@ -2450,7 +2450,16 @@ int main(int argc, char **argv) return ret; } - #warning need to implement for backward compatabilty + RGWPeriod period; + ret = period.init(g_ceph_context, store); + if (ret < 0) { + cerr << "ERROR: failed to read current period info: " << cpp_strerror(-ret) << std::endl; + return ret; + } + + period.fork(); + period.update(zonegroupmap); + period.store_info(false); encode_json("zonegroup-map", zonegroupmap, formatter); formatter->flush(cout); diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index da300ee3c83bb..fb0989a7d44b3 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -1061,6 +1061,19 @@ void RGWPeriod::fork() period_map.reset(); } +void RGWPeriod::update(const RGWZoneGroupMap& map) +{ + for (std::map::const_iterator iter = map.zonegroups.begin(); + iter != map.zonegroups.end(); iter++) { + period_map.zonegroups_by_api[iter->second.api_name] = iter->second; + period_map.zonegroups[iter->second.get_name()] = iter->second; + } + + period_config.bucket_quota = map.bucket_quota; + period_config.user_quota = map.user_quota; + period_map.master_zonegroup = map.master_zonegroup; +} + int RGWZoneParams::create_default(bool old_format) { name = default_zone_name; diff --git a/src/rgw/rgw_rados.h b/src/rgw/rgw_rados.h index 8f4124080ac48..fce95a364a623 100644 --- a/src/rgw/rgw_rados.h +++ b/src/rgw/rgw_rados.h @@ -1380,6 +1380,8 @@ public: sync_status = _sync_status; } + void update(const RGWZoneGroupMap& map); + int get_zonegroup(RGWZoneGroup& zonegroup, const string& zonegroup_id); -- 2.39.5