From f023f90091ac41eb205ce6ad7b7986d83a3343aa Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Tue, 11 Mar 2014 12:26:23 -0700 Subject: [PATCH] rgw: zone placement info includes extra data pool Signed-off-by: Yehuda Sadeh --- src/rgw/rgw_json_enc.cc | 2 ++ src/rgw/rgw_rados.cc | 1 + src/rgw/rgw_rados.h | 15 +++++++++++++-- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/rgw/rgw_json_enc.cc b/src/rgw/rgw_json_enc.cc index 044414a6df59f..4df7dafb4bfc7 100644 --- a/src/rgw/rgw_json_enc.cc +++ b/src/rgw/rgw_json_enc.cc @@ -616,12 +616,14 @@ void RGWZonePlacementInfo::dump(Formatter *f) const { encode_json("index_pool", index_pool, f); encode_json("data_pool", data_pool, f); + encode_json("data_extra_pool", data_extra_pool, f); } void RGWZonePlacementInfo::decode_json(JSONObj *obj) { JSONDecoder::decode_json("index_pool", index_pool, obj); JSONDecoder::decode_json("data_pool", data_pool, obj); + JSONDecoder::decode_json("data_extra_pool", data_extra_pool, obj); } void RGWZoneParams::decode_json(JSONObj *obj) diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index cb82e05e225df..5b320307a2c6f 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -2479,6 +2479,7 @@ int RGWRados::set_bucket_location_by_rule(const string& location_rule, const std RGWZonePlacementInfo& placement_info = piter->second; bucket.data_pool = placement_info.data_pool; + bucket.data_extra_pool = placement_info.data_extra_pool; bucket.index_pool = placement_info.index_pool; return 0; diff --git a/src/rgw/rgw_rados.h b/src/rgw/rgw_rados.h index 2263ae6242aab..e59b3b98918ea 100644 --- a/src/rgw/rgw_rados.h +++ b/src/rgw/rgw_rados.h @@ -739,20 +739,31 @@ struct RGWRegion; struct RGWZonePlacementInfo { string index_pool; string data_pool; + string data_extra_pool; /* if not set we should use data_pool */ void encode(bufferlist& bl) const { - ENCODE_START(3, 1, bl); + ENCODE_START(4, 1, bl); ::encode(index_pool, bl); ::encode(data_pool, bl); + ::encode(data_extra_pool, bl); ENCODE_FINISH(bl); } void decode(bufferlist::iterator& bl) { - DECODE_START(1, bl); + DECODE_START(4, bl); ::decode(index_pool, bl); ::decode(data_pool, bl); + if (struct_v >= 4) { + ::decode(data_extra_pool, bl); + } DECODE_FINISH(bl); } + const string& get_data_extra_pool() { + if (data_extra_pool.empty()) { + return data_pool; + } + return data_extra_pool; + } void dump(Formatter *f) const; void decode_json(JSONObj *obj); }; -- 2.39.5