From b8ab2f81d5d22ee8cf2d06341abdce05766a5919 Mon Sep 17 00:00:00 2001 From: James Page Date: Mon, 31 Mar 2014 09:56:37 +0100 Subject: [PATCH] Use template include for rabbitmq configuration --- templates/grizzly/cinder.conf | 16 ++++------------ templates/icehouse/cinder.conf | 21 ++------------------- templates/parts/rabbitmq | 21 +++++++++++++++++++++ 3 files changed, 27 insertions(+), 31 deletions(-) create mode 100644 templates/parts/rabbitmq diff --git a/templates/grizzly/cinder.conf b/templates/grizzly/cinder.conf index 18b09da4..f55ef2f7 100644 --- a/templates/grizzly/cinder.conf +++ b/templates/grizzly/cinder.conf @@ -18,22 +18,14 @@ volumes_dir = /var/lib/cinder/volumes {% if database_host -%} sql_connection = mysql://{{ database_user }}:{{ database_password }}@{{ database_host }}/{{ database }} {% endif -%} + +{% include "parts/rabbitmq" %} + {% if rabbitmq_host or rabbitmq_hosts -%} notification_driver = cinder.openstack.common.notifier.rabbit_notifier control_exchange = cinder -rabbit_userid = {{ rabbitmq_user }} -rabbit_password = {{ rabbitmq_password }} -rabbit_virtual_host = {{ rabbitmq_virtual_host }} -{% if rabbitmq_hosts -%} -rabbit_hosts = {{ rabbitmq_hosts }} -{% if rabbitmq_ha_queues -%} -rabbit_ha_queues = true -rabbit_durable_queues = false -{% endif %} -{% else %} -rabbit_host = {{ rabbitmq_host }} -{% endif -%} {% endif -%} + {% if volume_driver -%} volume_driver = {{ volume_driver }} {% endif -%} diff --git a/templates/icehouse/cinder.conf b/templates/icehouse/cinder.conf index 4bcf6c2d..b6592f1d 100644 --- a/templates/icehouse/cinder.conf +++ b/templates/icehouse/cinder.conf @@ -16,28 +16,11 @@ state_path = /var/lib/cinder lock_path = /var/lock/cinder volumes_dir = /var/lib/cinder/volumes +{% include "parts/rabbitmq" %} + {% if rabbitmq_host or rabbitmq_hosts -%} notification_driver = cinder.openstack.common.notifier.rpc_notifier control_exchange = cinder -{% if rabbit_ssl_port %} -rabbit_use_ssl=True -rabbit_port={{ rabbit_ssl_port }} -{% if rabbit_ssl_ca %} -kombu_ssl_ca_certs={{rabbit_ssl_ca}} -{% endif %} -{% endif %} -rabbit_userid = {{ rabbitmq_user }} -rabbit_password = {{ rabbitmq_password }} -rabbit_virtual_host = {{ rabbitmq_virtual_host }} -{% if rabbitmq_hosts -%} -rabbit_hosts = {{ rabbitmq_hosts }} -{% if rabbitmq_ha_queues -%} -rabbit_ha_queues = true -rabbit_durable_queues = false -{% endif %} -{% else %} -rabbit_host = {{ rabbitmq_host }} -{% endif -%} {% endif -%} {% if volume_driver -%} diff --git a/templates/parts/rabbitmq b/templates/parts/rabbitmq new file mode 100644 index 00000000..bbd0371d --- /dev/null +++ b/templates/parts/rabbitmq @@ -0,0 +1,21 @@ +{% if rabbitmq_host or rabbitmq_hosts -%} +rabbit_userid = {{ rabbitmq_user }} +rabbit_virtual_host = {{ rabbitmq_virtual_host }} +rabbit_password = {{ rabbitmq_password }} +{% if rabbitmq_hosts -%} +rabbit_hosts = {{ rabbitmq_hosts }} +{% if rabbitmq_ha_queues -%} +rabbit_ha_queues = True +rabbit_durable_queues = False +{% endif -%} +{% else -%} +rabbit_host = {{ rabbitmq_host }} +{% endif -%} +{% if rabbit_ssl_port -%} +rabbit_use_ssl = True +rabbit_port = {{ rabbit_ssl_port }} +{% if rabbit_ssl_ca -%} +kombu_ssl_ca_certs = {{ rabbit_ssl_ca }} +{% endif -%} +{% endif -%} +{% endif -%} \ No newline at end of file