[RabbitMQ] Parametrized message queue hosts to enable client-side HA.
Change-Id: I1eae4e7d839ca9a82804456e5d354ab9482d335b
diff --git a/README.rst b/README.rst
index 4a9bcbd..0ad803b 100644
--- a/README.rst
+++ b/README.rst
@@ -162,6 +162,27 @@
region: RegionTwo
...
+
+Client-side RabbitMQ HA setup
+
+.. code-block:: yaml
+
+ neutron:
+ 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'
+ ....
+
+
+
Usage
=====
diff --git a/metadata/service/control/cluster.yml b/metadata/service/control/cluster.yml
index 93ebddc..c5ef5c0 100644
--- a/metadata/service/control/cluster.yml
+++ b/metadata/service/control/cluster.yml
@@ -35,7 +35,6 @@
user: openstack
password: ${_param:rabbitmq_openstack_password}
virtual_host: '/openstack'
- ha_queues: true
compute:
host: ${_param:cluster_vip_address}
region: RegionOne
diff --git a/neutron/files/kilo/neutron-server.conf.contrail.Debian b/neutron/files/kilo/neutron-server.conf.contrail.Debian
index 9990cec..e43c49a 100644
--- a/neutron/files/kilo/neutron-server.conf.contrail.Debian
+++ b/neutron/files/kilo/neutron-server.conf.contrail.Debian
@@ -982,53 +982,27 @@
# The RabbitMQ broker address where a single node is used. (string value)
# Deprecated group/name - [DEFAULT]/rabbit_host
# rabbit_host = localhost
-rabbit_host = {{ neutron.message_queue.host }}
-rabbit_port = {{ neutron.message_queue.port }}
+
+
+{%- 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_userid = {{ neutron.message_queue.user }}
rabbit_password = {{ neutron.message_queue.password }}
rabbit_virtual_host = {{ neutron.message_queue.virtual_host }}
-# The RabbitMQ broker port where a single node is used. (integer value)
-# Deprecated group/name - [DEFAULT]/rabbit_port
-# rabbit_port = 5672
-# RabbitMQ HA cluster host:port pairs. (list value)
-# Deprecated group/name - [DEFAULT]/rabbit_hosts
-# rabbit_hosts = $rabbit_host:$rabbit_port
-
-# 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
-
-# The RabbitMQ password. (string value)
-# Deprecated group/name - [DEFAULT]/rabbit_password
-# rabbit_password = guest
-
-# 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 = /
-
-# How frequently to retry connecting with RabbitMQ. (integer value)
rabbit_retry_interval = 1
-# How long to backoff for between retries when connecting to RabbitMQ. (integer
-# value)
-# Deprecated group/name - [DEFAULT]/rabbit_retry_backoff
rabbit_retry_backoff = 2
-# Maximum number of RabbitMQ connection retries. Default is 0 (infinite retry
-# count). (integer value)
-# Deprecated group/name - [DEFAULT]/rabbit_max_retries
-# rabbit_max_retries = 0
rabbit_max_retries = 0
# Use HA queues in RabbitMQ (x-ha-policy: all). If you change this option, you
diff --git a/neutron/files/kilo/neutron-server.conf.contrail.RedHat b/neutron/files/kilo/neutron-server.conf.contrail.RedHat
index 1af2d3c..b09917f 100644
--- a/neutron/files/kilo/neutron-server.conf.contrail.RedHat
+++ b/neutron/files/kilo/neutron-server.conf.contrail.RedHat
@@ -982,53 +982,26 @@
# The RabbitMQ broker address where a single node is used. (string value)
# Deprecated group/name - [DEFAULT]/rabbit_host
# rabbit_host = localhost
-rabbit_host = {{ neutron.message_queue.host }}
-rabbit_port = {{ neutron.message_queue.port }}
+
+{%- 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_userid = {{ neutron.message_queue.user }}
rabbit_password = {{ neutron.message_queue.password }}
rabbit_virtual_host = {{ neutron.message_queue.virtual_host }}
-# The RabbitMQ broker port where a single node is used. (integer value)
-# Deprecated group/name - [DEFAULT]/rabbit_port
-# rabbit_port = 5672
-# RabbitMQ HA cluster host:port pairs. (list value)
-# Deprecated group/name - [DEFAULT]/rabbit_hosts
-# rabbit_hosts = $rabbit_host:$rabbit_port
-
-# 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
-
-# The RabbitMQ password. (string value)
-# Deprecated group/name - [DEFAULT]/rabbit_password
-# rabbit_password = guest
-
-# 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 = /
-
-# How frequently to retry connecting with RabbitMQ. (integer value)
rabbit_retry_interval = 1
-# How long to backoff for between retries when connecting to RabbitMQ. (integer
-# value)
-# Deprecated group/name - [DEFAULT]/rabbit_retry_backoff
rabbit_retry_backoff = 2
-# Maximum number of RabbitMQ connection retries. Default is 0 (infinite retry
-# count). (integer value)
-# Deprecated group/name - [DEFAULT]/rabbit_max_retries
-# rabbit_max_retries = 0
rabbit_max_retries = 0
# Use HA queues in RabbitMQ (x-ha-policy: all). If you change this option, you
diff --git a/neutron/files/liberty/neutron-server.conf.contrail.Debian b/neutron/files/liberty/neutron-server.conf.contrail.Debian
index 5b79d9c..7a657bb 100644
--- a/neutron/files/liberty/neutron-server.conf.contrail.Debian
+++ b/neutron/files/liberty/neutron-server.conf.contrail.Debian
@@ -988,53 +988,26 @@
# The RabbitMQ broker address where a single node is used. (string value)
# Deprecated group/name - [DEFAULT]/rabbit_host
# rabbit_host = localhost
-rabbit_host = {{ neutron.message_queue.host }}
-rabbit_port = {{ neutron.message_queue.port }}
+
+{%- 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_userid = {{ neutron.message_queue.user }}
rabbit_password = {{ neutron.message_queue.password }}
rabbit_virtual_host = {{ neutron.message_queue.virtual_host }}
-# The RabbitMQ broker port where a single node is used. (integer value)
-# Deprecated group/name - [DEFAULT]/rabbit_port
-# rabbit_port = 5672
-# RabbitMQ HA cluster host:port pairs. (list value)
-# Deprecated group/name - [DEFAULT]/rabbit_hosts
-# rabbit_hosts = $rabbit_host:$rabbit_port
-
-# 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
-
-# The RabbitMQ password. (string value)
-# Deprecated group/name - [DEFAULT]/rabbit_password
-# rabbit_password = guest
-
-# 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 = /
-
-# How frequently to retry connecting with RabbitMQ. (integer value)
rabbit_retry_interval = 1
-# How long to backoff for between retries when connecting to RabbitMQ. (integer
-# value)
-# Deprecated group/name - [DEFAULT]/rabbit_retry_backoff
rabbit_retry_backoff = 2
-# Maximum number of RabbitMQ connection retries. Default is 0 (infinite retry
-# count). (integer value)
-# Deprecated group/name - [DEFAULT]/rabbit_max_retries
-# rabbit_max_retries = 0
rabbit_max_retries = 0
# Use HA queues in RabbitMQ (x-ha-policy: all). If you change this option, you
diff --git a/neutron/files/liberty/neutron-server.conf.contrail.RedHat b/neutron/files/liberty/neutron-server.conf.contrail.RedHat
index 3bfbc44..75e8d5b 100644
--- a/neutron/files/liberty/neutron-server.conf.contrail.RedHat
+++ b/neutron/files/liberty/neutron-server.conf.contrail.RedHat
@@ -988,53 +988,25 @@
# The RabbitMQ broker address where a single node is used. (string value)
# Deprecated group/name - [DEFAULT]/rabbit_host
# rabbit_host = localhost
-rabbit_host = {{ neutron.message_queue.host }}
-rabbit_port = {{ neutron.message_queue.port }}
+
+{%- 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_userid = {{ neutron.message_queue.user }}
rabbit_password = {{ neutron.message_queue.password }}
rabbit_virtual_host = {{ neutron.message_queue.virtual_host }}
-# The RabbitMQ broker port where a single node is used. (integer value)
-# Deprecated group/name - [DEFAULT]/rabbit_port
-# rabbit_port = 5672
-
-# RabbitMQ HA cluster host:port pairs. (list value)
-# Deprecated group/name - [DEFAULT]/rabbit_hosts
-# rabbit_hosts = $rabbit_host:$rabbit_port
-
-# 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
-
-# The RabbitMQ password. (string value)
-# Deprecated group/name - [DEFAULT]/rabbit_password
-# rabbit_password = guest
-
-# 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 = /
-
-# How frequently to retry connecting with RabbitMQ. (integer value)
rabbit_retry_interval = 1
-# How long to backoff for between retries when connecting to RabbitMQ. (integer
-# value)
-# Deprecated group/name - [DEFAULT]/rabbit_retry_backoff
rabbit_retry_backoff = 2
-# Maximum number of RabbitMQ connection retries. Default is 0 (infinite retry
-# count). (integer value)
-# Deprecated group/name - [DEFAULT]/rabbit_max_retries
-# rabbit_max_retries = 0
rabbit_max_retries = 0
# Use HA queues in RabbitMQ (x-ha-policy: all). If you change this option, you
diff --git a/neutron/files/mitaka/neutron-server.conf.contrail.Debian b/neutron/files/mitaka/neutron-server.conf.contrail.Debian
index 46772c3..e6889e8 100644
--- a/neutron/files/mitaka/neutron-server.conf.contrail.Debian
+++ b/neutron/files/mitaka/neutron-server.conf.contrail.Debian
@@ -1281,8 +1281,16 @@
# RabbitMQ HA cluster host:port pairs. (list value)
# Deprecated group/name - [DEFAULT]/rabbit_hosts
#rabbit_hosts = $rabbit_host:$rabbit_port
+#
+{%- 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_userid = {{ server.message_queue.user }}
rabbit_password = {{ server.message_queue.password }}
@@ -1566,4 +1574,4 @@
# cipher list format. (string value)
#ciphers = <None>
[service_providers]
-service_provider = LOADBALANCER:Opencontrail:neutron_plugin_contrail.plugins.opencontrail.loadbalancer.driver.OpencontrailLoadbalancerDriver:default
\ No newline at end of file
+service_provider = LOADBALANCER:Opencontrail:neutron_plugin_contrail.plugins.opencontrail.loadbalancer.driver.OpencontrailLoadbalancerDriver:default
diff --git a/tests/pillar/control_cluster.sls b/tests/pillar/control_cluster.sls
index 9133472..3c669df 100644
--- a/tests/pillar/control_cluster.sls
+++ b/tests/pillar/control_cluster.sls
@@ -26,8 +26,10 @@
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'