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>
This commit is contained in:
Yehuda Sadeh 2012-12-19 16:59:43 -08:00
parent 799c59ae89
commit 08c64249eb
2 changed files with 19 additions and 2 deletions

View File

@ -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;

View File

@ -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() {