Merge "[RabbitMQ] Parametrized message queue hosts to enable client-side HA."
diff --git a/README.rst b/README.rst
index a2367bb..46546f1 100644
--- a/README.rst
+++ b/README.rst
@@ -69,6 +69,26 @@
source: http://cdn.download.cirros-cloud.net/0.3.1/cirros-0.3.1-x86_64-disk.img
public: true
+
+Client-side RabbitMQ HA setup
+
+.. code-block:: yaml
+
+ glance:
+ server:
+ ....
+ message_queue:
+ engine: rabbitmq
+ members:
+ - host: 10.0.16.1
+ - host: 10.0.16.2
+ - host: 10.0.16.3
+ user: openstack
+ password: pwd
+ virtual_host: '/openstack'
+ ....
+
+
Keystone and cinder region
============================
@@ -85,6 +105,7 @@
region: RegionTwo
...
+
Ceph integration glance
=======================
diff --git a/glance/files/kilo/glance-api.conf.Debian b/glance/files/kilo/glance-api.conf.Debian
index 34967c1..54a91b0 100644
--- a/glance/files/kilo/glance-api.conf.Debian
+++ b/glance/files/kilo/glance-api.conf.Debian
@@ -246,8 +246,17 @@
notification_driver = messagingv2
# Configuration options if sending notifications via rabbitmq (these are
# the defaults)
+
+{%- if server.message_queue.members is defined %}
+rabbit_hosts = {% for member in server.message_queue.members -%}
+ {{ member.host }}:{{ member.get('port', 5672) }}
+ {%- if not loop.last -%},{%- endif -%}
+ {%- endfor -%}
+{%- else %}
rabbit_host = {{ server.message_queue.host }}
rabbit_port = {{ server.message_queue.port }}
+{%- endif %}
+
rabbit_use_ssl = false
rabbit_userid = {{ server.message_queue.user }}
rabbit_password = {{ server.message_queue.password }}
diff --git a/glance/files/liberty/glance-api.conf.Debian b/glance/files/liberty/glance-api.conf.Debian
index 3acf3f3..daf8f1c 100644
--- a/glance/files/liberty/glance-api.conf.Debian
+++ b/glance/files/liberty/glance-api.conf.Debian
@@ -246,8 +246,17 @@
notification_driver = messagingv2
# Configuration options if sending notifications via rabbitmq (these are
# the defaults)
+#
+{%- if server.message_queue.members is defined %}
+rabbit_hosts = {% for member in server.message_queue.members -%}
+ {{ member.host }}:{{ member.get('port', 5672) }}
+ {%- if not loop.last -%},{%- endif -%}
+ {%- endfor -%}
+{%- else %}
rabbit_host = {{ server.message_queue.host }}
rabbit_port = {{ server.message_queue.port }}
+{%- endif %}
+
rabbit_use_ssl = false
rabbit_userid = {{ server.message_queue.user }}
rabbit_password = {{ server.message_queue.password }}
diff --git a/glance/files/mitaka/glance-api.conf.Debian b/glance/files/mitaka/glance-api.conf.Debian
index ccf27b8..e961239 100644
--- a/glance/files/mitaka/glance-api.conf.Debian
+++ b/glance/files/mitaka/glance-api.conf.Debian
@@ -1510,44 +1510,25 @@
# Allowed values: round-robin, shuffle
#kombu_failover_strategy = round-robin
-# The RabbitMQ broker address where a single node is used. (string
-# value)
-# Deprecated group/name - [DEFAULT]/rabbit_host
-#rabbit_host = localhost
+{%- if server.message_queue.members is defined %}
+rabbit_hosts = {% for member in server.message_queue.members -%}
+ {{ member.host }}:{{ member.get('port', 5672) }}
+ {%- if not loop.last -%},{%- endif -%}
+ {%- endfor -%}
+{%- else %}
rabbit_host = {{ server.message_queue.host }}
-
-# The RabbitMQ broker port where a single node is used. (port value)
-# Minimum value: 0
-# Maximum value: 65535
-# Deprecated group/name - [DEFAULT]/rabbit_port
-#rabbit_port = 5672
rabbit_port = {{ server.message_queue.port }}
-
-# RabbitMQ HA cluster host:port pairs. (list value)
-# Deprecated group/name - [DEFAULT]/rabbit_hosts
-#rabbit_hosts = $rabbit_host:$rabbit_port
+{%- endif %}
# Connect over SSL for RabbitMQ. (boolean value)
# Deprecated group/name - [DEFAULT]/rabbit_use_ssl
#rabbit_use_ssl = false
-
-# The RabbitMQ userid. (string value)
-# Deprecated group/name - [DEFAULT]/rabbit_userid
-#rabbit_userid = guest
rabbit_userid = {{ server.message_queue.user }}
-
-# The RabbitMQ password. (string value)
-# Deprecated group/name - [DEFAULT]/rabbit_password
-#rabbit_password = guest
rabbit_password = {{ server.message_queue.password }}
# The RabbitMQ login method. (string value)
# Deprecated group/name - [DEFAULT]/rabbit_login_method
#rabbit_login_method = AMQPLAIN
-
-# The RabbitMQ virtual host. (string value)
-# Deprecated group/name - [DEFAULT]/rabbit_virtual_host
-#rabbit_virtual_host = /
rabbit_virtual_host = {{ server.message_queue.virtual_host }}
# How frequently to retry connecting with RabbitMQ. (integer value)
diff --git a/tests/pillar/cluster.sls b/tests/pillar/cluster.sls
index 3e0e665..97a2d61 100644
--- a/tests/pillar/cluster.sls
+++ b/tests/pillar/cluster.sls
@@ -27,11 +27,12 @@
tenant: service
message_queue:
engine: rabbitmq
- host: 127.0.0.1
- port: 5672
+ members:
+ - host: 127.0.0.1
+ - host: 127.0.1.1
+ - host: 127.0.2.1
user: openstack
password: password
virtual_host: '/openstack'
- ha_queues: true
storage:
engine: file