From 3a07c8dd7f67292369a2ead0aa5ace9e12bf4229 Mon Sep 17 00:00:00 2001 From: Timur Nurlygayanov Date: Tue, 30 Jun 2015 15:59:31 +0300 Subject: [PATCH] Fixed issue with rabbit_ha_queues parameter We need to configure rabbit_ha_queues = True only if we have more than 1 RabbitMQ host. In we have one RabbitMQ host we need to set rabbit_ha_queues = False. We also need to use one pattern for configuration of this parameter for different OpenStack components. Also fixed issue with rabbit_hosts parameter, because we should initialize it with array, not with string or boolean value. Change-Id: Ia610241351074feccfbd54fab270ab27caa8a34b Closes-Bug: #1470054 --- manifests/init.pp | 17 +++++++++++++++-- spec/classes/neutron_init_spec.rb | 12 ++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 9e10c509c..c2130d119 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -145,6 +145,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. @@ -288,6 +292,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, @@ -446,12 +451,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 85f3dd513..a70aade72 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]) @@ -162,6 +168,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!(