diff options
author | Yehuda Sadeh <yehuda@inktank.com> | 2012-12-19 16:59:43 -0800 |
---|---|---|
committer | Yehuda Sadeh <yehuda@inktank.com> | 2012-12-19 22:03:56 -0800 |
commit | 08c64249eb8cd7922de5c398a9426538918db77c (patch) | |
tree | 360cb6f8d59973bb9ed95907c5db2b1c2b611027 | |
parent | 799c59ae89c9a70f08d9bf2e7624d25e6641d41f (diff) | |
download | ceph-08c64249eb8cd7922de5c398a9426538918db77c.tar.gz |
rgw: don't initialize keystone if not set up
Fixes: #3653
No need to initialize keystone, including the keystone
revocation thread which was verbose if key stone was
not set up. This removes some unuseful errors from the
log.
Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
-rw-r--r-- | src/rgw/rgw_swift.cc | 14 | ||||
-rw-r--r-- | src/rgw/rgw_swift.h | 7 |
2 files changed, 19 insertions, 2 deletions
diff --git a/src/rgw/rgw_swift.cc b/src/rgw/rgw_swift.cc index 9eda1eda071..9bb7cecad82 100644 --- a/src/rgw/rgw_swift.cc +++ b/src/rgw/rgw_swift.cc @@ -644,7 +644,7 @@ bool RGWSwift::verify_swift_token(RGWRados *store, req_state *s) int ret; - if (!cct->_conf->rgw_keystone_url.empty()) { + if (supports_keystone()) { ret = validate_keystone_token(store, s->os_auth_token, &info, s->user); return (ret >= 0); } @@ -678,7 +678,13 @@ bool RGWSwift::verify_swift_token(RGWRados *store, req_state *s) void RGWSwift::init() { get_str_list(cct->_conf->rgw_keystone_accepted_roles, roles_list); + if (supports_keystone()) + init_keystone(); +} + +void RGWSwift::init_keystone() +{ keystone_token_cache = new RGWKeystoneTokenCache(cct, cct->_conf->rgw_keystone_token_cache_size); keystone_revoke_thread = new KeystoneRevokeThread(cct, this); @@ -688,6 +694,12 @@ void RGWSwift::init() void RGWSwift::finalize() { + if (supports_keystone()) + finalize_keystone(); +} + +void RGWSwift::finalize_keystone() +{ delete keystone_token_cache; keystone_token_cache = NULL; diff --git a/src/rgw/rgw_swift.h b/src/rgw/rgw_swift.h index 6c5024e1a54..febc2675c27 100644 --- a/src/rgw/rgw_swift.h +++ b/src/rgw/rgw_swift.h @@ -64,11 +64,16 @@ class RGWSwift { void init(); void finalize(); + void init_keystone(); + void finalize_keystone(); + bool supports_keystone() { + return !cct->_conf->rgw_keystone_url.empty(); + } protected: int check_revoked(); public: - RGWSwift(CephContext *_cct) : cct(_cct) { + RGWSwift(CephContext *_cct) : cct(_cct), keystone_revoke_thread(NULL) { init(); } ~RGWSwift() { |