From a7096f8f07607e1bb17666a0ec0d9f275ef332e9 Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Mon, 20 May 2013 12:13:31 -0700 Subject: [PATCH] rgw: add access key to zone info Signed-off-by: Yehuda Sadeh --- src/rgw/rgw_common.h | 1 + src/rgw/rgw_json_enc.cc | 15 +++++++++++++++ src/rgw/rgw_rados.h | 8 ++++++-- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/rgw/rgw_common.h b/src/rgw/rgw_common.h index 1403f655e8fb6..fcbef98fc7faa 100644 --- a/src/rgw/rgw_common.h +++ b/src/rgw/rgw_common.h @@ -309,6 +309,7 @@ struct RGWAccessKey { DECODE_FINISH(bl); } void dump(Formatter *f) const; + void dump_plain(Formatter *f) const; void dump(Formatter *f, const string& user, bool swift) const; static void generate_test_instances(list& o); diff --git a/src/rgw/rgw_json_enc.cc b/src/rgw/rgw_json_enc.cc index 030754583182b..74042116967cf 100644 --- a/src/rgw/rgw_json_enc.cc +++ b/src/rgw/rgw_json_enc.cc @@ -176,6 +176,19 @@ void RGWAccessKey::dump(Formatter *f) const encode_json("subuser", subuser, f); } +void RGWAccessKey::dump_plain(Formatter *f) const +{ + encode_json("access_key", id, f); + encode_json("secret_key", key, f); +} + +void encode_json_plain(const char *name, const RGWAccessKey& val, Formatter *f) +{ + f->open_object_section(name); + val.dump_plain(f); + f->close_section(); +} + void RGWAccessKey::dump(Formatter *f, const string& user, bool swift) const { string u = user; @@ -464,6 +477,7 @@ void RGWZoneParams::dump(Formatter *f) const encode_json("user_email_pool", user_email_pool.data_pool, f); encode_json("user_swift_pool", user_swift_pool.data_pool, f); encode_json("user_uid_pool ", user_uid_pool.data_pool, f); + encode_json_plain("system_key", system_key, f); } static void decode_json(const char *field, rgw_bucket& bucket, JSONObj *obj) @@ -488,6 +502,7 @@ void RGWZoneParams::decode_json(JSONObj *obj) ::decode_json("user_email_pool", user_email_pool, obj); ::decode_json("user_swift_pool", user_swift_pool, obj); ::decode_json("user_uid_pool ", user_uid_pool, obj); + JSONDecoder::decode_json("system_key", system_key, obj); } void RGWZone::dump(Formatter *f) const diff --git a/src/rgw/rgw_rados.h b/src/rgw/rgw_rados.h index f487a98b7d522..d4733aef8422b 100644 --- a/src/rgw/rgw_rados.h +++ b/src/rgw/rgw_rados.h @@ -268,6 +268,8 @@ struct RGWZoneParams { string name; + RGWAccessKey system_key; + static string get_pool_name(CephContext *cct); void init_name(CephContext *cct, RGWRegion& region); int init(CephContext *cct, RGWRados *store, RGWRegion& region); @@ -275,7 +277,7 @@ struct RGWZoneParams { int store_info(CephContext *cct, RGWRados *store, RGWRegion& region); void encode(bufferlist& bl) const { - ENCODE_START(2, 1, bl); + ENCODE_START(3, 1, bl); ::encode(domain_root, bl); ::encode(control_pool, bl); ::encode(gc_pool, bl); @@ -291,7 +293,7 @@ struct RGWZoneParams { } void decode(bufferlist::iterator& bl) { - DECODE_START(2, bl); + DECODE_START(3, bl); ::decode(domain_root, bl); ::decode(control_pool, bl); ::decode(gc_pool, bl); @@ -304,6 +306,8 @@ struct RGWZoneParams { ::decode(user_uid_pool, bl); if (struct_v >= 2) ::decode(name, bl); + if (struct_v >= 3) + ::decode(system_key, bl); DECODE_FINISH(bl); } void dump(Formatter *f) const; -- 2.39.5