Skip to content

Commit 3af547a

Browse files
committed
Fix operation on clouds with availability-zones
In a cloud with AZs, you can get multiple entries back from the service catalog - one for each AZ and then one that is AZ agnostic that's tied to the region. If the region_name is plumbed all the way through, this works as intended. Change-Id: I3b365ea306e8111fc80830672ae8080a5d1dc8e0
1 parent f0c57e1 commit 3af547a

4 files changed

Lines changed: 6 additions & 5 deletions

File tree

‎openstackclient/common/clientmanager.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,13 +110,13 @@ def __init__(self, auth_options, api_version=None, verify=True):
110110

111111
return
112112

113-
def get_endpoint_for_service_type(self, service_type):
113+
def get_endpoint_for_service_type(self, service_type, region_name=None):
114114
"""Return the endpoint URL for the service type."""
115115
# See if we are using password flow auth, i.e. we have a
116116
# service catalog to select endpoints from
117117
if self._service_catalog:
118118
endpoint = self._service_catalog.url_for(
119-
service_type=service_type)
119+
service_type=service_type, region_name=region_name)
120120
else:
121121
# Hope we were given the correct URL.
122122
endpoint = self._auth_url or self._url

‎openstackclient/compute/client.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def make_client(instance):
6868
else:
6969
# password flow
7070
client.client.management_url = instance.get_endpoint_for_service_type(
71-
API_NAME)
71+
API_NAME, region_name=instance._region_name)
7272
client.client.service_catalog = instance._service_catalog
7373
client.client.auth_token = instance._token
7474
return client

‎openstackclient/network/client.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ def make_client(instance):
3535
LOG.debug('Instantiating network client: %s', network_client)
3636

3737
if not instance._url:
38-
instance._url = instance.get_endpoint_for_service_type("network")
38+
instance._url = instance.get_endpoint_for_service_type(
39+
"network", region_name=instance._region_name)
3940
return network_client(
4041
username=instance._username,
4142
tenant_name=instance._project_name,

‎openstackclient/volume/client.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def make_client(instance):
6868
else:
6969
# password flow
7070
client.client.management_url = instance.get_endpoint_for_service_type(
71-
API_NAME)
71+
API_NAME, region_name=instance._region_name)
7272
client.client.service_catalog = instance._service_catalog
7373
client.client.auth_token = instance._token
7474

0 commit comments

Comments
 (0)