From e541fcb0d47e0beb447fb1a3ce1d62881fa382f8 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Wed, 3 Jul 2013 15:53:55 +0200 Subject: [PATCH] Allow to specify the endpoint type to use Not everybody will want to use publicURL, so let's make this configurable. Change-Id: Ice85a8ef1083580d89285e83239de872939665af Fixes: bug#1188469 --- ceilometer/alarm/service.py | 3 ++- ceilometer/alarm/threshold_evaluation.py | 3 ++- ceilometer/nova_client.py | 1 + ceilometer/service.py | 4 ++++ doc/source/configuration.rst | 1 + etc/ceilometer/ceilometer.conf.sample | 6 +++++- 6 files changed, 15 insertions(+), 3 deletions(-) diff --git a/ceilometer/alarm/service.py b/ceilometer/alarm/service.py index 0e66956f6..f72959a17 100644 --- a/ceilometer/alarm/service.py +++ b/ceilometer/alarm/service.py @@ -77,7 +77,8 @@ class SingletonAlarmService(os_service.Service): os_auth_url=auth_config.os_auth_url, os_tenant_name=auth_config.os_tenant_name, os_password=auth_config.os_password, - os_username=auth_config.os_username + os_username=auth_config.os_username, + endpoint_type=auth_config.os_endpoint_type, ) return ceiloclient.get_client(2, **creds) diff --git a/ceilometer/alarm/threshold_evaluation.py b/ceilometer/alarm/threshold_evaluation.py index f5adf8750..19dfe89e9 100644 --- a/ceilometer/alarm/threshold_evaluation.py +++ b/ceilometer/alarm/threshold_evaluation.py @@ -71,7 +71,8 @@ class Evaluator(object): os_auth_url=auth_config.os_auth_url, os_tenant_name=auth_config.os_tenant_name, os_password=auth_config.os_password, - os_username=auth_config.os_username + os_username=auth_config.os_username, + endpoint_type=auth_config.os_endpoint_type, ) self.api_client = ceiloclient.get_client(2, **creds) return self.api_client diff --git a/ceilometer/nova_client.py b/ceilometer/nova_client.py index d43b98f24..4923107de 100644 --- a/ceilometer/nova_client.py +++ b/ceilometer/nova_client.py @@ -51,6 +51,7 @@ class Client(object): api_key=cfg.CONF.service_credentials.os_password, project_id=tenant, auth_url=cfg.CONF.service_credentials.os_auth_url, + endpoint_type=cfg.CONF.service_credentials.os_endpoint_type, no_cache=True) def _with_flavor_and_image(self, instances): diff --git a/ceilometer/service.py b/ceilometer/service.py index 5f4041a38..726870652 100644 --- a/ceilometer/service.py +++ b/ceilometer/service.py @@ -62,6 +62,10 @@ CLI_OPTIONS = [ default=os.environ.get('OS_AUTH_URL', 'http://localhost:5000/v2.0'), help='Auth URL to use for openstack service access'), + cfg.StrOpt('os-endpoint-type', + default=os.environ.get('OS_ENDPOINT_TYPE', 'publicURL'), + help='Type of endpoint in Identity service catalog to use for ' + 'communication with OpenStack services.'), ] cfg.CONF.register_cli_opts(CLI_OPTIONS, group="service_credentials") diff --git a/doc/source/configuration.rst b/doc/source/configuration.rst index cd8d45fe9..5847ea2e2 100644 --- a/doc/source/configuration.rst +++ b/doc/source/configuration.rst @@ -59,6 +59,7 @@ os_password admin Password os_tenant_id Tenant ID to use for openstack service access os_tenant_name admin Tenant name to use for openstack service access os_auth_url http://localhost:5000/v2.0 Auth URL to use for openstack service access +os_endpoint_type publicURL Endpoint type in the catalog to use to access services =============================== ==================================== ============================================================== Keystone Middleware Authentication diff --git a/etc/ceilometer/ceilometer.conf.sample b/etc/ceilometer/ceilometer.conf.sample index 9d927e9e0..70b66c0e6 100644 --- a/etc/ceilometer/ceilometer.conf.sample +++ b/etc/ceilometer/ceilometer.conf.sample @@ -583,6 +583,10 @@ # Auth URL to use for openstack service access (string value) #os_auth_url=http://localhost:5000/v2.0 +# Type of endpoint in Identity service catalog to use for +# communication with OpenStack services. (string value) +#os_endpoint_type=publicURL + [collector] @@ -631,4 +635,4 @@ #password= -# Total option count: 121 +# Total option count: 122