]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: add tier config for zone params
authorYehuda Sadeh <yehuda@redhat.com>
Wed, 3 Aug 2016 00:06:38 +0000 (17:06 -0700)
committerYehuda Sadeh <yehuda@redhat.com>
Fri, 7 Oct 2016 16:58:21 +0000 (09:58 -0700)
Needed for sync module instance configuration

Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/rgw/rgw_data_sync.cc
src/rgw/rgw_json_enc.cc
src/rgw/rgw_rados.h

index b23467a8951f41bf0de77b2ea83c66148eb4537c..b93922413f78fdddf94e66ed06bedb9b13a8d28d 100644 (file)
@@ -1605,13 +1605,13 @@ int RGWDataSyncStatusManager::init()
 
   auto& zone_def = zone_def_iter->second;
 
-  map<string, string> sync_module_config;
-
   if (!store->get_sync_modules_manager()->supports_data_export(zone_def.tier_type)) {
     return -ENOTSUP;
   }
 
-  int r = store->get_sync_modules_manager()->create_instance(zone_def.tier_type, sync_module_config, &sync_module);
+  RGWZoneParams& zone_params = store->get_zone_params();
+
+  int r = store->get_sync_modules_manager()->create_instance(zone_def.tier_type, zone_params.tier_config, &sync_module);
   if (r < 0) {
     lderr(store->ctx()) << "ERROR: failed to init sync module instance, r=" << r << dendl;
     finalize();
@@ -1624,15 +1624,15 @@ int RGWDataSyncStatusManager::init()
     return -EINVAL;
   }
 
-  const char *log_pool = store->get_zone_params().log_pool.name.c_str();
+  const char *log_pool = zone_params.log_pool.name.c_str();
   librados::Rados *rados = store->get_rados_handle();
   r = rados->ioctx_create(log_pool, ioctx);
   if (r < 0) {
-    lderr(store->ctx()) << "ERROR: failed to open log pool (" << store->get_zone_params().log_pool.name << " ret=" << r << dendl;
+    lderr(store->ctx()) << "ERROR: failed to open log pool (" << zone_params.log_pool.name << " ret=" << r << dendl;
     return r;
   }
 
-  source_status_obj = rgw_obj(store->get_zone_params().log_pool, RGWDataSyncStatusManager::sync_status_oid(source_zone));
+  source_status_obj = rgw_obj(zone_params.log_pool, RGWDataSyncStatusManager::sync_status_oid(source_zone));
 
   error_logger = new RGWSyncErrorLogger(store, RGW_SYNC_ERROR_LOG_SHARD_PREFIX, ERROR_LOGGER_SHARDS);
 
@@ -1654,7 +1654,7 @@ int RGWDataSyncStatusManager::init()
   num_shards = datalog_info.num_shards;
 
   for (int i = 0; i < num_shards; i++) {
-    shard_objs[i] = rgw_obj(store->get_zone_params().log_pool, shard_obj_name(source_zone, i));
+    shard_objs[i] = rgw_obj(zone_params.log_pool, shard_obj_name(source_zone, i));
   }
 
   return 0;
index b368e1562c85af1505ff3dc1b4343c1d374033ec..c9584ff78d5d5b9b1d89a5663719f185134d3574 100644 (file)
@@ -858,6 +858,7 @@ void RGWZoneParams::dump(Formatter *f) const
   encode_json_plain("system_key", system_key, f);
   encode_json("placement_pools", placement_pools, f);
   encode_json("metadata_heap", metadata_heap.data_pool, f);
+  encode_json("tier_config", tier_config, f);
   encode_json("realm_id", realm_id, f);
 }
 
@@ -903,6 +904,7 @@ void RGWZoneParams::decode_json(JSONObj *obj)
   JSONDecoder::decode_json("system_key", system_key, obj);
   JSONDecoder::decode_json("placement_pools", placement_pools, obj);
   ::decode_json("metadata_heap", metadata_heap, obj);
+  JSONDecoder::decode_json("tier_config", tier_config, obj);
   JSONDecoder::decode_json("realm_id", realm_id, obj);
 
 }
index 024c22516b792d5b9ba5e21374eede8e9818639d..13e1a7b3c97f6e862485c87ee0700b2ba32e8069 100644 (file)
@@ -913,6 +913,8 @@ struct RGWZoneParams : RGWSystemMetaObj {
 
   string realm_id;
 
+  map<string, string> tier_config;
+
   RGWZoneParams() : RGWSystemMetaObj() {}
   RGWZoneParams(const string& name) : RGWSystemMetaObj(name){}
   RGWZoneParams(const string& id, const string& name) : RGWSystemMetaObj(id, name) {}
@@ -935,7 +937,7 @@ struct RGWZoneParams : RGWSystemMetaObj {
   int fix_pool_names();
   
   void encode(bufferlist& bl) const {
-    ENCODE_START(7, 1, bl);
+    ENCODE_START(8, 1, bl);
     ::encode(domain_root, bl);
     ::encode(control_pool, bl);
     ::encode(gc_pool, bl);
@@ -952,11 +954,12 @@ struct RGWZoneParams : RGWSystemMetaObj {
     ::encode(metadata_heap, bl);
     ::encode(realm_id, bl);
     ::encode(lc_pool, bl);
+    ::encode(tier_config, bl);
     ENCODE_FINISH(bl);
   }
 
   void decode(bufferlist::iterator& bl) {
-    DECODE_START(7, bl);
+    DECODE_START(8, bl);
     ::decode(domain_root, bl);
     ::decode(control_pool, bl);
     ::decode(gc_pool, bl);
@@ -987,6 +990,9 @@ struct RGWZoneParams : RGWSystemMetaObj {
     } else {
       lc_pool = name + ".rgw.lc";
     }
+    if (struct_v >= 8) {
+      ::decode(tier_config, bl);
+    }
     DECODE_FINISH(bl);
   }
   void dump(Formatter *f) const;