From: Yehuda Sadeh Date: Thu, 20 Dec 2012 00:59:43 +0000 (-0800) Subject: rgw: don't initialize keystone if not set up X-Git-Tag: v0.56~41 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=08c64249eb8cd7922de5c398a9426538918db77c;p=ceph.git 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 --- diff --git a/src/rgw/rgw_swift.cc b/src/rgw/rgw_swift.cc index 9eda1eda0714..9bb7cecad821 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); @@ -687,6 +693,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 6c5024e1a54c..febc2675c27d 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() {