diff --git a/AUTHORS b/AUTHORS index b22a34261..b8b92ab5c 100644 --- a/AUTHORS +++ b/AUTHORS @@ -12,6 +12,7 @@ Chmouel Boudjnah Chris Behrens Christian Berendt Christopher MacGown +Chuck Thier Cole Robinson Dan Prince Dan Wendlandt diff --git a/novaclient/client.py b/novaclient/client.py index 3bd3ec68a..5f845c928 100644 --- a/novaclient/client.py +++ b/novaclient/client.py @@ -42,7 +42,7 @@ class HTTPClient(httplib2.Http): timeout=None, proxy_tenant_id=None, proxy_token=None, region_name=None, endpoint_type='publicURL', service_type=None, - service_name=None): + service_name=None, volume_service_name=None): super(HTTPClient, self).__init__(timeout=timeout) self.user = user self.password = password @@ -53,6 +53,7 @@ class HTTPClient(httplib2.Http): self.endpoint_type = endpoint_type self.service_type = service_type self.service_name = service_name + self.volume_service_name = volume_service_name self.management_url = None self.auth_token = None @@ -159,11 +160,12 @@ class HTTPClient(httplib2.Http): self.auth_token = self.service_catalog.get_token() management_url = self.service_catalog.url_for( - attr='region', - filter_value=self.region_name, - endpoint_type=self.endpoint_type, - service_type=self.service_type, - service_name=self.service_name) + attr='region', + filter_value=self.region_name, + endpoint_type=self.endpoint_type, + service_type=self.service_type, + service_name=self.service_name, + volume_service_name=self.volume_service_name,) self.management_url = management_url.rstrip('/') return None except exceptions.AmbiguousEndpoints: diff --git a/novaclient/service_catalog.py b/novaclient/service_catalog.py index b18e12924..14a286739 100644 --- a/novaclient/service_catalog.py +++ b/novaclient/service_catalog.py @@ -30,7 +30,7 @@ class ServiceCatalog(object): def url_for(self, attr=None, filter_value=None, service_type=None, endpoint_type='publicURL', - service_name=None): + service_name=None, volume_service_name=None): """Fetch the public URL from the Compute service for a particular endpoint attribute. If none given, return the first. See tests for sample service catalog.""" @@ -54,7 +54,12 @@ class ServiceCatalog(object): if service.get("type") != service_type: continue - if service_name and service.get('name') != service_name: + if (service_name and service_type == 'compute' and + service.get('name') != service_name): + continue + + if (volume_service_name and service_type == 'volume' and + service.get('name') != volume_service_name): continue endpoints = service['endpoints'] diff --git a/novaclient/shell.py b/novaclient/shell.py index ed59a48bb..76509d8f6 100644 --- a/novaclient/shell.py +++ b/novaclient/shell.py @@ -113,6 +113,10 @@ class OpenStackComputeShell(object): default=utils.env('NOVA_SERVICE_NAME'), help='Defaults to env[NOVA_SERVICE_NAME]') + parser.add_argument('--volume_service_name', + default=utils.env('NOVA_VOLUME_SERVICE_NAME'), + help='Defaults to env[NOVA_VOLUME_SERVICE_NAME]') + parser.add_argument('--endpoint_type', default=utils.env('NOVA_ENDPOINT_TYPE', default=DEFAULT_NOVA_ENDPOINT_TYPE), @@ -292,14 +296,15 @@ class OpenStackComputeShell(object): return 0 (os_username, os_password, os_tenant_name, os_auth_url, - os_region_name, endpoint_type, - insecure, service_type, service_name, + os_region_name, endpoint_type, insecure, + service_type, service_name, volume_service_name, username, apikey, projectid, url, region_name) = ( args.os_username, args.os_password, args.os_tenant_name, args.os_auth_url, args.os_region_name, args.endpoint_type, args.insecure, args.service_type, args.service_name, - args.username, args.apikey, args.projectid, + args.volume_service_name, args.username, + args.apikey, args.projectid, args.url, args.region_name) if not endpoint_type: @@ -360,7 +365,8 @@ class OpenStackComputeShell(object): os_password, os_tenant_name, os_auth_url, insecure, region_name=os_region_name, endpoint_type=endpoint_type, extensions=self.extensions, service_type=service_type, - service_name=service_name) + service_name=service_name, + volume_service_name=volume_service_name) try: if not utils.isunauthenticated(args.func): diff --git a/novaclient/v1_1/client.py b/novaclient/v1_1/client.py index f02c62d91..047080c54 100644 --- a/novaclient/v1_1/client.py +++ b/novaclient/v1_1/client.py @@ -44,7 +44,8 @@ class Client(object): insecure=False, timeout=None, proxy_tenant_id=None, proxy_token=None, region_name=None, endpoint_type='publicURL', extensions=None, - service_type='compute', service_name=None): + service_type='compute', service_name=None, + volume_service_name=None): # FIXME(comstud): Rename the api_key argument above when we # know it's not being used as keyword argument password = api_key @@ -83,17 +84,18 @@ class Client(object): extension.manager_class(self)) self.client = client.HTTPClient(username, - password, - project_id, - auth_url, - insecure=insecure, - timeout=timeout, - proxy_token=proxy_token, - proxy_tenant_id=proxy_tenant_id, - region_name=region_name, - endpoint_type=endpoint_type, - service_type=service_type, - service_name=service_name) + password, + project_id, + auth_url, + insecure=insecure, + timeout=timeout, + proxy_token=proxy_token, + proxy_tenant_id=proxy_tenant_id, + region_name=region_name, + endpoint_type=endpoint_type, + service_type=service_type, + service_name=service_name, + volume_service_name=volume_service_name) def authenticate(self): """