From 589fe2ed63cdfb7277a75a6c4e7a1ef152b6d269 Mon Sep 17 00:00:00 2001 From: Orit Wasserman Date: Wed, 9 Sep 2015 10:54:47 +0200 Subject: [PATCH] radosgw-admin: Add master_zonegroup and master_zone to period prepare Signed-off-by: Orit Wasserman --- src/rgw/rgw_admin.cc | 9 ++++++++- src/rgw/rgw_rados.h | 8 +++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc index 7e068a348d266..01eeba50fb457 100644 --- a/src/rgw/rgw_admin.cc +++ b/src/rgw/rgw_admin.cc @@ -173,6 +173,8 @@ void _usage() cerr << " --remote= remote to pull period\n"; cerr << " --parent= parent period id\n"; cerr << " --period= period id\n"; + cerr << " --master-zonegroup= master zonegroup id\n"; + cerr << " --master-zone= master zone id\n"; cerr << " --realm= realm name\n"; cerr << " --realm-id= realm id\n"; cerr << " --realm-new-name= realm new name\n"; @@ -1252,6 +1254,7 @@ int main(int argc, char **argv) std::string start_date, end_date; std::string key_type_str; std::string period_id, url, parent_period; + std::string master_zonegroup, master_zone; std::string realm_name, realm_id, realm_new_name; std::string zone_name, zone_id, zone_new_name; std::string zonegroup_name, zonegroup_id, zonegroup_new_name; @@ -1547,6 +1550,10 @@ int main(int argc, char **argv) } } else if (ceph_argparse_witharg(args, i, &val, "--parent", (char*)NULL)) { parent_period = val; + } else if (ceph_argparse_witharg(args, i, &val, "--master-zonegroup", (char*)NULL)) { + master_zonegroup = val; + } else if (ceph_argparse_witharg(args, i, &val, "--master-zone", (char*)NULL)) { + master_zone = val; } else if (ceph_argparse_witharg(args, i, &val, "--period", (char*)NULL)) { period_id = val; } else if (ceph_argparse_witharg(args, i, &val, "--url", (char*)NULL)) { @@ -1688,7 +1695,7 @@ int main(int argc, char **argv) switch (opt_cmd) { case OPT_PERIOD_PREPARE: { - RGWPeriod period( g_ceph_context, store); + RGWPeriod period(g_ceph_context, store, master_zonegroup, master_zone); int ret = period.create(); if (ret < 0) { cerr << "ERROR: couldn't prepare new period " << ": " << cpp_strerror(-ret) << std::endl; diff --git a/src/rgw/rgw_rados.h b/src/rgw/rgw_rados.h index 9288d5dbf8d18..ea642bd80801f 100644 --- a/src/rgw/rgw_rados.h +++ b/src/rgw/rgw_rados.h @@ -1274,6 +1274,12 @@ public: const string& period_id = "", epoch_t _epoch = 0) : id(period_id), epoch(_epoch), cct(_cct), store(_store) {} + RGWPeriod(CephContext *_cct, RGWRados *_store, + const string& _master_zonegroup, const string& _master_zone, + const string& period_id = "", epoch_t _epoch = 0) + : id(period_id), epoch(_epoch), master_zonegroup(_master_zonegroup), master_zone(_master_zone), cct(_cct), + store(_store) {} + string get_id() { return id;} epoch_t get_epoch() { return epoch;} string get_predecessor() { return predecessor_uuid;} @@ -1283,7 +1289,7 @@ public: const string& get_pool_name(CephContext *cct); const string& get_latest_epoch_oid(); const string& get_info_oid_prefix(); - + int get_latest_epoch(epoch_t& epoch); int init(const string& realm_id = "", const string &realm_name = "", bool setup_obj = true); int init(const string& period_id, epoch_t epoch, bool setup_obj = true); -- 2.39.5