From c169b75feb356921afa9d50833f57feefdda7d6a Mon Sep 17 00:00:00 2001 From: Orit Wasserman Date: Thu, 3 Sep 2015 10:49:44 +0200 Subject: [PATCH] rgw: add id to RGWZone Signed-off-by: Orit Wasserman --- src/rgw/rgw_json_enc.cc | 2 +- src/rgw/rgw_rados.h | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/rgw/rgw_json_enc.cc b/src/rgw/rgw_json_enc.cc index 6f703a5a57089..4ab68b2315987 100644 --- a/src/rgw/rgw_json_enc.cc +++ b/src/rgw/rgw_json_enc.cc @@ -868,7 +868,7 @@ static void decode_zones(map& zones, JSONObj *o) { RGWZone z; z.decode_json(o); - zones[z.name] = z; + zones[z.id] = z; } static void decode_placement_targets(map& targets, JSONObj *o) diff --git a/src/rgw/rgw_rados.h b/src/rgw/rgw_rados.h index d7c46cf362819..05f01e9c171a9 100644 --- a/src/rgw/rgw_rados.h +++ b/src/rgw/rgw_rados.h @@ -908,6 +908,7 @@ struct RGWZoneParams { WRITE_CLASS_ENCODER(RGWZoneParams) struct RGWZone { + string id; string name; list endpoints; bool log_meta; @@ -925,7 +926,8 @@ struct RGWZone { RGWZone() : log_meta(false), log_data(false), bucket_index_max_shards(0) {} void encode(bufferlist& bl) const { - ENCODE_START(3, 1, bl); + ENCODE_START(4, 1, bl); + ::encode(id, bl); ::encode(name, bl); ::encode(endpoints, bl); ::encode(log_meta, bl); @@ -935,8 +937,14 @@ struct RGWZone { } void decode(bufferlist::iterator& bl) { - DECODE_START(2, bl); + DECODE_START(3, bl); + if (struct_v >= 4) { + ::decode(id, bl); + } ::decode(name, bl); + if (struct_v < 4) { + id = name; + } ::decode(endpoints, bl); if (struct_v >= 2) { ::decode(log_meta, bl); -- 2.39.5