Add rabbit HA configurations
This commit will add the rabbit HA related two configurations: - rabbit_hosts - rabbit_ha_queues Change-Id: I85c329778de7baf138ec860e09f7e1572ad4c19a
This commit is contained in:
parent
d0d8d07afb
commit
67e3279071
|
@ -11,6 +11,7 @@ This file is used to list changes made in each version of the openstack-metering
|
|||
h_algorithms to be configurable
|
||||
* Remove old nosql check for running dbsync
|
||||
* Bump Chef gem to 11.16
|
||||
* Allow rabbit_hosts and rabbit_ha_queues to be configurable
|
||||
|
||||
## 10.0.0
|
||||
* Upgrading to Juno
|
||||
|
|
|
@ -47,6 +47,7 @@ end
|
|||
mq_service_type = node['openstack']['mq']['telemetry']['service_type']
|
||||
|
||||
if mq_service_type == 'rabbitmq'
|
||||
node['openstack']['mq']['telemetry']['rabbit']['ha'] && (rabbit_hosts = rabbit_servers)
|
||||
mq_password = get_password 'user', node['openstack']['mq']['telemetry']['rabbit']['userid']
|
||||
elsif mq_service_type == 'qpid'
|
||||
mq_password = get_password 'user', node['openstack']['mq']['telemetry']['qpid']['username']
|
||||
|
@ -99,6 +100,7 @@ template node['openstack']['telemetry']['conf'] do
|
|||
identity_admin_endpoint: identity_admin_endpoint,
|
||||
mq_service_type: mq_service_type,
|
||||
mq_password: mq_password,
|
||||
rabbit_hosts: rabbit_hosts,
|
||||
service_pass: service_pass,
|
||||
service_tenant_name: service_tenant,
|
||||
service_user: service_user,
|
||||
|
|
|
@ -84,20 +84,63 @@ describe 'openstack-telemetry::common' do
|
|||
node.set['openstack']['mq']['telemetry']['service_type'] = 'rabbitmq'
|
||||
end
|
||||
|
||||
it 'has default rabbit_* options set' do
|
||||
[
|
||||
/^rabbit_userid = guest$/,
|
||||
/^rabbit_password = mq-pass$/,
|
||||
/^rabbit_port = 5672$/,
|
||||
/^rabbit_host = 127.0.0.1$/,
|
||||
/^rabbit_virtual_host = \/$/,
|
||||
/^rabbit_use_ssl = false$/,
|
||||
%r{^auth_uri = http://127.0.0.1:5000/v2.0$},
|
||||
/^auth_host = 127.0.0.1$/,
|
||||
/^auth_port = 35357$/,
|
||||
/^auth_protocol = http$/
|
||||
].each do |line|
|
||||
expect(chef_run).to render_file(file.name).with_content(line)
|
||||
describe 'ha rabbit disabled' do
|
||||
before do
|
||||
node.override['openstack']['mq']['telemetry']['rabbit']['ha'] = false
|
||||
end
|
||||
|
||||
it 'has default rabbit_* options set' do
|
||||
[
|
||||
/^rabbit_userid = guest$/,
|
||||
/^rabbit_password = mq-pass$/,
|
||||
/^rabbit_port = 5672$/,
|
||||
/^rabbit_host = 127.0.0.1$/,
|
||||
/^rabbit_virtual_host = \/$/,
|
||||
/^rabbit_use_ssl = false$/,
|
||||
%r{^auth_uri = http://127.0.0.1:5000/v2.0$},
|
||||
/^auth_host = 127.0.0.1$/,
|
||||
/^auth_port = 35357$/,
|
||||
/^auth_protocol = http$/
|
||||
].each do |line|
|
||||
expect(chef_run).to render_file(file.name).with_content(line)
|
||||
end
|
||||
end
|
||||
|
||||
it 'does not have ha rabbit options set' do
|
||||
[/^rabbit_hosts = /,
|
||||
/^rabbit_ha_queues = /].each do |line|
|
||||
expect(chef_run).not_to render_file(file.name).with_content(line)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'ha rabbit enabled' do
|
||||
before do
|
||||
node.override['openstack']['mq']['telemetry']['rabbit']['ha'] = true
|
||||
end
|
||||
|
||||
it 'sets ha rabbit options correctly' do
|
||||
[
|
||||
/^rabbit_userid = guest$/,
|
||||
/^rabbit_password = mq-pass$/,
|
||||
/^rabbit_hosts = 1.1.1.1:5672,2.2.2.2:5672$/,
|
||||
/^rabbit_ha_queues = True$/,
|
||||
/^rabbit_virtual_host = \/$/,
|
||||
/^rabbit_use_ssl = false$/,
|
||||
%r{^auth_uri = http://127.0.0.1:5000/v2.0$},
|
||||
/^auth_host = 127.0.0.1$/,
|
||||
/^auth_port = 35357$/,
|
||||
/^auth_protocol = http$/
|
||||
].each do |line|
|
||||
expect(chef_run).to render_file(file.name).with_content(line)
|
||||
end
|
||||
end
|
||||
|
||||
it 'does not have non-ha rabbit options set' do
|
||||
[/^rabbit_host = /,
|
||||
/^rabbit_port = /].each do |line|
|
||||
expect(chef_run).not_to render_file(file.name).with_content(line)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -25,6 +25,8 @@ UBUNTU_OPTS = {
|
|||
|
||||
shared_context 'telemetry-stubs' do
|
||||
before do
|
||||
allow_any_instance_of(Chef::Recipe).to receive(:rabbit_servers)
|
||||
.and_return '1.1.1.1:5672,2.2.2.2:5672'
|
||||
allow_any_instance_of(Chef::Recipe).to receive(:memcached_servers).and_return([])
|
||||
allow_any_instance_of(Chef::Recipe).to receive(:get_password)
|
||||
.with('db', anything)
|
||||
|
|
|
@ -23,8 +23,13 @@ amqp_auto_delete=<%= node["openstack"]["mq"]["telemetry"]["auto_delete"] %>
|
|||
##### RABBITMQ #####
|
||||
rabbit_userid = <%= node["openstack"]["mq"]["telemetry"]["rabbit"]["userid"] %>
|
||||
rabbit_password = <%= @mq_password %>
|
||||
<% if node["openstack"]["mq"]["telemetry"]["rabbit"]["ha"] %>
|
||||
rabbit_hosts = <%= @rabbit_hosts %>
|
||||
rabbit_ha_queues = True
|
||||
<% else %>
|
||||
rabbit_port = <%= node["openstack"]["mq"]["telemetry"]["rabbit"]["port"] %>
|
||||
rabbit_host = <%= node["openstack"]["mq"]["telemetry"]["rabbit"]["host"] %>
|
||||
<% end %>
|
||||
rabbit_virtual_host = <%= node["openstack"]["mq"]["telemetry"]["rabbit"]["vhost"] %>
|
||||
rabbit_use_ssl = <%= node["openstack"]["mq"]["telemetry"]["rabbit"]["use_ssl"] %>
|
||||
rpc_backend = ceilometer.openstack.common.rpc.impl_kombu
|
||||
|
|
Loading…
Reference in New Issue