From 959d6e7f12561ffa46fdd31e12288cabb1405eed Mon Sep 17 00:00:00 2001 From: Edward Hope-Morley Date: Thu, 31 Mar 2016 20:12:40 +0100 Subject: [PATCH] Support using internal network for clients Openstack mostly defaults to using public endpoints for internal communication between services. This patch adds a new option use-internal-endpoints which, if set to True, will configure services to use internal endpoints where possible. Change-Id: I170e5e1eef3d2e3bb28d37606a468328005609d0 Closes-Bug: 1456876 --- config.yaml | 7 ++++++ hooks/ceilometer_utils.py | 6 +++-- templates/grizzly/ceilometer.conf | 23 ------------------- .../{havana => icehouse}/ceilometer.conf | 10 ++++++-- 4 files changed, 19 insertions(+), 27 deletions(-) delete mode 100644 templates/grizzly/ceilometer.conf rename templates/{havana => icehouse}/ceilometer.conf (91%) diff --git a/config.yaml b/config.yaml index e3b5e5d..e276cbf 100644 --- a/config.yaml +++ b/config.yaml @@ -50,3 +50,10 @@ options: wait for you to execute the openstack-upgrade action for this charm on each unit. If False it will revert to existing behavior of upgrading all units on config change. + use-internal-endpoints: + default: False + type: boolean + description: | + Openstack mostly defaults to using public endpoints for + internal communication between services. If set to True this option will + configure services to use internal endpoints where possible. diff --git a/hooks/ceilometer_utils.py b/hooks/ceilometer_utils.py index df2eb66..2190ec5 100644 --- a/hooks/ceilometer_utils.py +++ b/hooks/ceilometer_utils.py @@ -1,8 +1,9 @@ from charmhelpers.contrib.openstack import ( + context, templating, ) from ceilometer_contexts import ( - CeilometerServiceContext + CeilometerServiceContext, ) from charmhelpers.contrib.openstack.utils import ( get_os_codename_package, @@ -51,7 +52,8 @@ NOVA_SETTINGS = { CONFIG_FILES = { CEILOMETER_CONF: { 'hook_contexts': [ - CeilometerServiceContext(ssl_dir=CEILOMETER_CONF_DIR)], + CeilometerServiceContext(ssl_dir=CEILOMETER_CONF_DIR), + context.InternalEndpointContext()], 'services': CEILOMETER_AGENT_SERVICES } } diff --git a/templates/grizzly/ceilometer.conf b/templates/grizzly/ceilometer.conf deleted file mode 100644 index 4c13af9..0000000 --- a/templates/grizzly/ceilometer.conf +++ /dev/null @@ -1,23 +0,0 @@ -# grizzly -############################################################################### -# [ WARNING ] -# ceilometer configuration file maintained by Juju -# local changes may be overwritten. -############################################################################### -[DEFAULT] -debug = {{ debug }} -verbose = {{ verbose }} -{% if metering_secret -%} -metering_secret = {{ metering_secret }} -{% endif -%} -{% include "parts/rabbitmq" %} -{% if auth_host -%} -os_auth_url = {{ auth_protocol }}://{{ auth_host }}:{{ auth_port }}/v2.0 -os_tenant_name = {{ admin_tenant_name }} -os_username = {{ admin_user }} -os_password = {{ admin_password }} -{% endif -%} -logdir = /var/log/ceilometer -# NOTE(jamespage) this allows the db sync process to run OK for upgrades -# fixed in icehouse -database_connection=sqlite:////var/lib/ceilometer/ceilometer.sqlite diff --git a/templates/havana/ceilometer.conf b/templates/icehouse/ceilometer.conf similarity index 91% rename from templates/havana/ceilometer.conf rename to templates/icehouse/ceilometer.conf index 6157f75..ed778f0 100644 --- a/templates/havana/ceilometer.conf +++ b/templates/icehouse/ceilometer.conf @@ -1,4 +1,4 @@ -# havana +# icehouse ############################################################################### # [ WARNING ] # ceilometer configuration file maintained by Juju @@ -7,8 +7,12 @@ [DEFAULT] debug = {{ debug }} verbose = {{ verbose }} -{% include "parts/rabbitmq" %} logdir = /var/log/ceilometer +{% include "parts/rabbitmq" %} +{% if use_internal_endpoints -%} +interface = internal +{% endif -%} + {% if auth_host -%} [service_credentials] os_auth_url = {{ auth_protocol }}://{{ auth_host }}:{{ auth_port }}/v2.0 @@ -16,10 +20,12 @@ os_tenant_name = {{ admin_tenant_name }} os_username = {{ admin_user }} os_password = {{ admin_password }} {% endif -%} + {% if metering_secret -%} [publisher_rpc] metering_secret = {{ metering_secret }} {% endif -%} + [database] # NOTE(jamespage) this allows the db sync process to run OK for upgrades # fixed in icehouse