keystone: pass region name to keystone client

If multiple Keystone are registered into the catalog and Keystone API is used
(e.g. gnocchi dispatcher uses it to find the project id), then the region is
picked randomly by Keystone client to choose the Keystone server.

Change-Id: Ia6ae72994431bfcf31c10866c7079784487411c1
(cherry picked from commit 89ef6422f1)
This commit is contained in:
Julien Danjou 2017-08-14 18:13:45 +02:00
parent ef3cff89a8
commit 11be2c8314
1 changed files with 4 additions and 2 deletions

View File

@ -38,10 +38,12 @@ def get_session(conf, requests_session=None, group=None, timeout=None):
return session
def get_client(conf, trust_id=None, requests_session=None, group=None):
def get_client(conf, trust_id=None, requests_session=None,
group=DEFAULT_GROUP):
"""Return a client for keystone v3 endpoint, optionally using a trust."""
session = get_session(conf, requests_session=requests_session, group=group)
return ks_client_v3.Client(session=session, trust_id=trust_id)
return ks_client_v3.Client(session=session, trust_id=trust_id,
region_name=conf[group].region_name)
def get_service_catalog(client):