From a88f8e6a7b8cafb7f631334f1cc96b4f99980cc3 Mon Sep 17 00:00:00 2001 From: Timur Nurlygayanov Date: Tue, 30 Jun 2015 14:30:02 +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. Change-Id: I6f25905b000494264cacbd13ba74daba538c6cf7 Closes-Bug: #1470054 --- manifests/init.pp | 17 +++++++++++++++-- spec/classes/keystone_spec.rb | 10 ++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 8726bb1d8..6a6541645 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -219,6 +219,10 @@ # (optional) Location of rabbitmq installation. # Defaults to $::os_service_default # +# [*rabbit_ha_queues*] +# (Optional) Use HA queues in RabbitMQ. +# Defaults to undef. +# # [*rabbit_password*] # (optional) Password used to connect to rabbitmq. # Defaults to $::os_service_default @@ -567,6 +571,7 @@ class keystone( $rabbit_heartbeat_timeout_threshold = $::os_service_default, $rabbit_heartbeat_rate = $::os_service_default, $rabbit_use_ssl = $::os_service_default, + $rabbit_ha_queues = undef, $kombu_ssl_ca_certs = $::os_service_default, $kombu_ssl_certfile = $::os_service_default, $kombu_ssl_keyfile = $::os_service_default, @@ -828,17 +833,25 @@ class keystone( if ! is_service_default($rabbit_hosts) and $rabbit_hosts { keystone_config { 'oslo_messaging_rabbit/rabbit_hosts': value => join($rabbit_hosts, ','); - 'oslo_messaging_rabbit/rabbit_ha_queues': value => true; } } else { keystone_config { 'oslo_messaging_rabbit/rabbit_host': value => $rabbit_host; 'oslo_messaging_rabbit/rabbit_port': value => $rabbit_port; - 'oslo_messaging_rabbit/rabbit_ha_queues': value => false; 'oslo_messaging_rabbit/rabbit_hosts': ensure => absent; } } + if $rabbit_ha_queues != undef { + keystone_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => $rabbit_ha_queues } + } else { + if ! is_service_default($rabbit_hosts) and $rabbit_hosts { + keystone_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => true } + } else { + keystone_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => false } + } + } + keystone_config { 'oslo_messaging_rabbit/rabbit_use_ssl': value => $rabbit_use_ssl; 'oslo_messaging_rabbit/rabbit_password': value => $rabbit_password, secret => true; diff --git a/spec/classes/keystone_spec.rb b/spec/classes/keystone_spec.rb index 36b3cf70f..d71bebb60 100644 --- a/spec/classes/keystone_spec.rb +++ b/spec/classes/keystone_spec.rb @@ -105,6 +105,7 @@ describe 'keystone' do 'rabbit_userid' => 'admin', 'rabbit_heartbeat_timeout_threshold' => '60', 'rabbit_heartbeat_rate' => '10', + 'rabbit_ha_queues' => true, 'default_domain' => 'other_domain', 'using_domain_config' => false } @@ -237,6 +238,15 @@ describe 'keystone' do end end + it 'should ensure rabbit_ha_queues' do + if param_hash['rabbit_ha_queues'] + is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value(param_hash['rabbit_ha_queues']) + else + is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value(false) + end + + end + if param_hash['default_domain'] it { is_expected.to contain_keystone_domain(param_hash['default_domain']).with(:is_default => true) } it { is_expected.to contain_anchor('default_domain_created') }