[RabbitMQ] Parameterized message queue hosts to enable client-side HA.

Change-Id: I8fead4ffcc59e02660a45a4226375141bf73a6f0
diff --git a/README.rst b/README.rst
index 7e59df8..8ed186a 100644
--- a/README.rst
+++ b/README.rst
@@ -38,7 +38,6 @@
           user: openstack
           password: pwd
           virtual_host: '/openstack'
-          rabbit_ha_queues: true
         database:
           engine: mongodb
           host: 127.0.0.1
@@ -47,6 +46,25 @@
           user: ceilometer
           password: pwd
 
+Client-side RabbitMQ HA setup
+
+.. code-block:: yaml
+
+    ceilometer:
+      server:
+        ....
+        message_queue:
+          engine: rabbitmq
+          members:
+          - host: 127.0.0.1
+          - host: 127.0.0.1
+          - host: 127.0.0.1
+          user: openstack
+          password: pwd
+          virtual_host: '/openstack'
+       ....
+
+
 Ceilometer Graphite publisher
 
 .. code-block:: yaml
diff --git a/ceilometer/files/kilo/ceilometer-server.conf.Debian b/ceilometer/files/kilo/ceilometer-server.conf.Debian
index ca02494..787b1a4 100644
--- a/ceilometer/files/kilo/ceilometer-server.conf.Debian
+++ b/ceilometer/files/kilo/ceilometer-server.conf.Debian
@@ -511,6 +511,15 @@
 #kombu_reconnect_delay = 1.0
 kombu_reconnect_delay = 5.0
 
+# RabbitMQ HA cluster host:port pairs. (list value)
+# Deprecated group/name - [DEFAULT]/rabbit_hosts
+{%- 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 %}
+
 # The RabbitMQ broker address where a single node is used. (string
 # value)
 # Deprecated group/name - [DEFAULT]/rabbit_host
@@ -523,9 +532,7 @@
 #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
diff --git a/ceilometer/files/liberty/ceilometer-server.conf.Debian b/ceilometer/files/liberty/ceilometer-server.conf.Debian
index 9e8291d..3238895 100644
--- a/ceilometer/files/liberty/ceilometer-server.conf.Debian
+++ b/ceilometer/files/liberty/ceilometer-server.conf.Debian
@@ -512,6 +512,15 @@
 #kombu_reconnect_delay = 1.0
 kombu_reconnect_delay = 5.0
 
+# RabbitMQ HA cluster host:port pairs. (list value)
+# Deprecated group/name - [DEFAULT]/rabbit_hosts
+{%- 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 %}
+
 # The RabbitMQ broker address where a single node is used. (string
 # value)
 # Deprecated group/name - [DEFAULT]/rabbit_host
@@ -524,9 +533,7 @@
 #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
diff --git a/metadata/service/server/cluster.yml b/metadata/service/server/cluster.yml
index 6f250c8..d2ff0e3 100644
--- a/metadata/service/server/cluster.yml
+++ b/metadata/service/server/cluster.yml
@@ -29,7 +29,6 @@
         user: openstack
         password: ${_param:rabbitmq_openstack_password}
         virtual_host: '/openstack'
-        ha_queues: true
         # Workaround for https://bugs.launchpad.net/ceilometer/+bug/1337715
         rpc_thread_pool_size: 5
       database:
diff --git a/tests/pillar/server_cluster.sls b/tests/pillar/server_cluster.sls
index b273bd3..9b3c41c 100644
--- a/tests/pillar/server_cluster.sls
+++ b/tests/pillar/server_cluster.sls
@@ -19,12 +19,13 @@
       password: password
     message_queue:
       engine: rabbitmq
-      host: 127.0.0.1
-      port: 5672
+      members:
+      - host: 127.0.0.1
+      - host: 127.0.0.1
+      - host: 127.0.0.1
       user: openstack
       password: password
       virtual_host: '/openstack'
-      ha_queues: true
       # Workaround for https://bugs.launchpad.net/ceilometer/+bug/1337715
       rpc_thread_pool_size: 5
     database: