]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw_admin: config options to set sync_from and sync_from_all
authorYehuda Sadeh <yehuda@redhat.com>
Fri, 26 Aug 2016 21:08:47 +0000 (14:08 -0700)
committerYehuda Sadeh <yehuda@redhat.com>
Fri, 7 Oct 2016 17:31:28 +0000 (10:31 -0700)
Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/rgw/rgw_admin.cc
src/rgw/rgw_rados.cc
src/rgw/rgw_rados.h

index dac0aef839276bb806db89a0b306c9216c5466f9..f2e56e37ba754a4e36cfa24b92f501f94fd24828 100644 (file)
@@ -2009,6 +2009,11 @@ int main(int argc, char **argv)
   std::string zonegroup_name, zonegroup_id, zonegroup_new_name;
   std::string api_name;
   list<string> endpoints;
+  int tmp_int;
+  int sync_from_all_specified = false;
+  bool sync_from_all = false;
+  list<string> sync_from;
+  list<string> 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;
index 48751e0466423ca3ff677d7b04b6f23b7c50ad6e..af003c7f6a9dce061f58279166a209a44aec216c 100644 (file)
@@ -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<string>& endpoints,
-                           const string *ptier_type)
+int RGWZoneGroup::add_zone(const RGWZoneParams& zone_params, bool *is_master, bool *read_only,
+                           const list<string>& endpoints, const string *ptier_type,
+                           bool *psync_from_all, list<string>& sync_from, list<string>& sync_from_rm)
 {
   auto& zone_id = zone_params.get_id();
   auto& zone_name = zone_params.get_name();
index e1263d21b6a2be2ccbfdd074256310bc0988f8ce..7cb8f667db34b481fef6fd06ec1e6aafff6326b7 100644 (file)
@@ -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<string>& endpoints, const string *ptier_type);
+  int add_zone(const RGWZoneParams& zone_params, bool *is_master, bool *read_only,
+               const list<string>& endpoints, const string *ptier_type,
+               bool *psync_from_all, list<string>& sync_from, list<string>& 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);