Allow on-the-fly mq clusters

Add attribute to allow mq cluster to be built on-the-fly rather
than searching nodes.

Change-Id: I1196f95465c0cb21824954feb261b9d1cfd84d26
Closes-Bug: #1412886
This commit is contained in:
Mark Vanderwiel 2015-01-20 11:29:14 -06:00
parent dadf0931c6
commit e706132417
4 changed files with 18 additions and 5 deletions

View File

@ -9,7 +9,8 @@ This file is used to list changes made in each version of cookbook-openstack-ops
* No need to push our rabbit user/password to rabbit cookbook
* Add a temp workaround for an issue #153 in rabbit cookbook to notify
rabbitmq-server to restart immediately.
* Add another workaround for the issue #153 in rabbit cookbook.
* Add another workaround for the issue #153 in rabbit cookbook
* Allow cluster_disk_nodes not to be set to allow on-the-fly mq clusters
## 10.0.0
* Upgrading to Juno

View File

@ -21,6 +21,11 @@
default['openstack']['mq']['cluster'] = false
# Allow cluster_disk_nodes to be optionally set based upon a node role search.
# If set to false, mq cluster nodes can be added on-the-fly using the cluster command.
# see https://www.rabbitmq.com/clustering.html
default['openstack']['mq']['search_for_cluster_disk_nodes'] = true
if platform_family?('debian', 'suse')
override['rabbitmq']['use_distro_version'] = true
end

View File

@ -48,10 +48,12 @@ node.override['rabbitmq']['address'] = listen_address
if node['openstack']['mq']['cluster']
node.override['rabbitmq']['cluster'] = node['openstack']['mq']['cluster']
node.override['rabbitmq']['erlang_cookie'] = get_password 'service', 'rabbit_cookie'
qs = "roles:#{node['openstack']['mq']['server_role']} AND chef_environment:#{node.chef_environment}"
node.override['rabbitmq']['cluster_disk_nodes'] = search(:node, qs).map do |n|
"#{user}@#{n['hostname']}"
end.sort
if node['openstack']['mq']['search_for_cluster_disk_nodes']
qs = "roles:#{node['openstack']['mq']['server_role']} AND chef_environment:#{node.chef_environment}"
node.override['rabbitmq']['cluster_disk_nodes'] = search(:node, qs).map do |n|
"#{user}@#{n['hostname']}"
end.sort
end
end
include_recipe 'rabbitmq'

View File

@ -69,6 +69,11 @@ describe 'openstack-ops-messaging::rabbitmq-server' do
['guest@host1', 'guest@host2']
)
end
it 'does not search for cluster_disk_nodes' do
node.set['openstack']['mq']['search_for_cluster_disk_nodes'] = false
expect(chef_run.node['rabbitmq']['cluster_disk_nodes']).to eq([])
end
end
it 'includes rabbit recipes' do