diff --git a/manifests/init.pp b/manifests/init.pp index 9988977cb..80d26fd9f 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -149,6 +149,10 @@ # multiple RabbitMQ Brokers. # Defaults to false # +# [*rabbit_ha_queues*] +# (Optional) Use HA queues in RabbitMQ. +# Defaults to undef +# # [*rabbit_heartbeat_timeout_threshold*] # (optional) Number of seconds after which the RabbitMQ broker is considered # down if the heartbeat keepalive fails. Any value >0 enables heartbeats. @@ -293,6 +297,7 @@ class neutron ( $rabbit_host = 'localhost', $rabbit_hosts = false, $rabbit_port = 5672, + $rabbit_ha_queues = undef, $rabbit_user = 'guest', $rabbit_virtual_host = $::os_service_default, $rabbit_heartbeat_timeout_threshold = 0, @@ -452,12 +457,20 @@ class neutron ( } if $rabbit_hosts { neutron_config { 'oslo_messaging_rabbit/rabbit_hosts': value => join($rabbit_hosts, ',') } - neutron_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => true } } else { neutron_config { 'oslo_messaging_rabbit/rabbit_host': value => $rabbit_host } neutron_config { 'oslo_messaging_rabbit/rabbit_port': value => $rabbit_port } neutron_config { 'oslo_messaging_rabbit/rabbit_hosts': value => "${rabbit_host}:${rabbit_port}" } - neutron_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => false } + } + + if $rabbit_ha_queues == undef { + if $rabbit_hosts { + neutron_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => true } + } else { + neutron_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => false } + } + } else { + neutron_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => $rabbit_ha_queues } } neutron_config { diff --git a/spec/classes/neutron_init_spec.rb b/spec/classes/neutron_init_spec.rb index c99a1c6dd..f5d39992b 100644 --- a/spec/classes/neutron_init_spec.rb +++ b/spec/classes/neutron_init_spec.rb @@ -45,6 +45,12 @@ describe 'neutron' do it_configures 'rabbit HA with multiple hosts' end + context 'with rabbit_ha_queues set to false and with rabbit_hosts' do + before { params.merge!( :rabbit_ha_queues => 'false', + :rabbit_hosts => ['rabbit:5673'] ) } + it_configures 'rabbit_ha_queues set to false' + end + it 'configures logging' do is_expected.to contain_neutron_config('DEFAULT/log_file').with_ensure('absent') is_expected.to contain_neutron_config('DEFAULT/log_dir').with_value(params[:log_dir]) @@ -164,6 +170,12 @@ describe 'neutron' do end end + shared_examples_for 'rabbit_ha_queues set to false' do + it 'in neutron.conf' do + is_expected.to contain_neutron_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value(false) + end + end + shared_examples_for 'with SSL socket options set' do before do params.merge!(