From: Yehuda Sadeh Date: Fri, 26 Aug 2016 21:08:47 +0000 (-0700) Subject: rgw_admin: config options to set sync_from and sync_from_all X-Git-Tag: v11.1.0~681^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=5f3c41fa2604b363157bb60360e24a3d065721e5;p=ceph.git rgw_admin: config options to set sync_from and sync_from_all Signed-off-by: Yehuda Sadeh --- diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc index dac0aef839276..f2e56e37ba754 100644 --- a/src/rgw/rgw_admin.cc +++ b/src/rgw/rgw_admin.cc @@ -2009,6 +2009,11 @@ int main(int argc, char **argv) std::string zonegroup_name, zonegroup_id, zonegroup_new_name; std::string api_name; list endpoints; + int tmp_int; + int sync_from_all_specified = false; + bool sync_from_all = false; + list sync_from; + list sync_from_rm; std::string master_url; int is_master_int; int set_default = 0; @@ -2376,6 +2381,13 @@ int main(int argc, char **argv) zone_new_name = val; } else if (ceph_argparse_witharg(args, i, &val, "--endpoints", (char*)NULL)) { get_str_list(val, endpoints); + } else if (ceph_argparse_witharg(args, i, &val, "--sync-from", (char*)NULL)) { + get_str_list(val, sync_from); + } else if (ceph_argparse_witharg(args, i, &val, "--sync-from-rm", (char*)NULL)) { + get_str_list(val, sync_from_rm); + } else if (ceph_argparse_binary_flag(args, i, &tmp_int, NULL, "--sync-from-all", (char*)NULL)) { + sync_from_all = (bool)tmp_int; + sync_from_all_specified = true; } else if (ceph_argparse_witharg(args, i, &val, "--source-zone", (char*)NULL)) { source_zone_name = val; } else if (ceph_argparse_witharg(args, i, &val, "--tier-type", (char*)NULL)) { @@ -2921,10 +2933,13 @@ int main(int argc, char **argv) string *ptier_type = (tier_type_specified ? &tier_type : nullptr); zone.tier_config = tier_config_add; + bool *psync_from_all = (sync_from_all_specified ? &sync_from_all : nullptr); + ret = zonegroup.add_zone(zone, (is_master_set ? &is_master : NULL), (is_read_only_set ? &read_only : NULL), - endpoints, ptier_type); + endpoints, ptier_type, + psync_from_all, sync_from, sync_from_rm); if (ret < 0) { cerr << "failed to add zone " << zone_name << " to zonegroup " << zonegroup.get_name() << ": " << cpp_strerror(-ret) << std::endl; @@ -3340,11 +3355,14 @@ int main(int argc, char **argv) if (!zonegroup_id.empty() || !zonegroup_name.empty()) { string *ptier_type = (tier_type_specified ? &tier_type : nullptr); + bool *psync_from_all = (sync_from_all_specified ? &sync_from_all : nullptr); ret = zonegroup.add_zone(zone, (is_master_set ? &is_master : NULL), (is_read_only_set ? &read_only : NULL), endpoints, - ptier_type); + ptier_type, + psync_from_all, + sync_from, sync_from_rm); if (ret < 0) { cerr << "failed to add zone " << zone_name << " to zonegroup " << zonegroup.get_name() << ": " << cpp_strerror(-ret) << std::endl; @@ -3612,10 +3630,13 @@ int main(int argc, char **argv) } string *ptier_type = (tier_type_specified ? &tier_type : nullptr); + bool *psync_from_all = (sync_from_all_specified ? &sync_from_all : nullptr); + ret = zonegroup.add_zone(zone, (is_master_set ? &is_master : NULL), (is_read_only_set ? &read_only : NULL), - endpoints, ptier_type); + endpoints, ptier_type, + psync_from_all, sync_from, sync_from_rm); if (ret < 0) { cerr << "failed to update zonegroup: " << cpp_strerror(-ret) << std::endl; return -ret; diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index 48751e0466423..af003c7f6a9dc 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -247,8 +247,9 @@ int RGWZoneGroup::equals(const string& other_zonegroup) const return (id == other_zonegroup); } -int RGWZoneGroup::add_zone(const RGWZoneParams& zone_params, bool *is_master, bool *read_only, const list& endpoints, - const string *ptier_type) +int RGWZoneGroup::add_zone(const RGWZoneParams& zone_params, bool *is_master, bool *read_only, + const list& endpoints, const string *ptier_type, + bool *psync_from_all, list& sync_from, list& sync_from_rm) { auto& zone_id = zone_params.get_id(); auto& zone_name = zone_params.get_name(); diff --git a/src/rgw/rgw_rados.h b/src/rgw/rgw_rados.h index e1263d21b6a2b..7cb8f667db34b 100644 --- a/src/rgw/rgw_rados.h +++ b/src/rgw/rgw_rados.h @@ -1230,7 +1230,9 @@ struct RGWZoneGroup : public RGWSystemMetaObj { int set_as_default(bool exclusive = false) override; int create_default(bool old_format = false); int equals(const string& other_zonegroup) const; - int add_zone(const RGWZoneParams& zone_params, bool *is_master, bool *read_only, const list& endpoints, const string *ptier_type); + int add_zone(const RGWZoneParams& zone_params, bool *is_master, bool *read_only, + const list& endpoints, const string *ptier_type, + bool *psync_from_all, list& sync_from, list& sync_from_rm); int remove_zone(const std::string& zone_id); int rename_zone(const RGWZoneParams& zone_params); const string& get_pool_name(CephContext *cct);