Update kombu_ options

Add additional kombu options: kombu_missing_consumer_retry_timeout,
kombu_failover_strategy,kombu_compression

Remove inneeded kombu related checks (covered by puppet-oslo)

Change-Id: Ib7803942e7a5cf3c4eb5aa589e00ffb9bfed35f9
This commit is contained in:
Sergey Kolekonov 2016-05-06 11:56:25 +03:00
parent 7070b6b639
commit 1cd4668990
3 changed files with 129 additions and 116 deletions

View File

@ -198,6 +198,24 @@
# reconnect. See https://review.openstack.org/#/c/76686
# Defaults to $::os_service_default
#
# [*kombu_missing_consumer_retry_timeout*]
# (Optional) How long to wait a missing client beforce abandoning to send it
# its replies. This value should not be longer than rpc_response_timeout.
# (integer value)
# Defaults to $::os_service_default
#
# [*kombu_failover_strategy*]
# (Optional) Determines how the next RabbitMQ node is chosen in case the one
# we are currently connected to becomes unavailable. Takes effect only if
# more than one RabbitMQ node is provided in config. (string value)
# Defaults to $::os_service_default
#
# [*kombu_compression*]
# (optional) Possible values are: gzip, bz2. If not set compression will not
# be used. This option may notbe available in future versions. EXPERIMENTAL.
# (string value)
# Defaults to $::os_service_default
#
# [*use_ssl*]
# (optinal) Enable SSL on the API server
# Defaults to $::os_service_default
@ -321,6 +339,9 @@ class neutron (
$kombu_ssl_keyfile = $::os_service_default,
$kombu_ssl_version = $::os_service_default,
$kombu_reconnect_delay = $::os_service_default,
$kombu_missing_consumer_retry_timeout = $::os_service_default,
$kombu_failover_strategy = $::os_service_default,
$kombu_compression = $::os_service_default,
$use_ssl = $::os_service_default,
$cert_file = $::os_service_default,
$key_file = $::os_service_default,
@ -362,20 +383,12 @@ class neutron (
}
}
if ! is_service_default($rabbit_use_ssl) and !($rabbit_use_ssl) {
if ! is_service_default($kombu_ssl_ca_certs) and ($kombu_ssl_ca_certs) {
fail('The kombu_ssl_ca_certs parameter requires rabbit_use_ssl to be set to true')
}
if ! is_service_default($kombu_ssl_certfile) and ($kombu_ssl_certfile) {
fail('The kombu_ssl_certfile parameter requires rabbit_use_ssl to be set to true')
}
if ! is_service_default($kombu_ssl_keyfile) and ($kombu_ssl_keyfile) {
fail('The kombu_ssl_keyfile parameter requires rabbit_use_ssl to be set to true')
}
}
if (is_service_default($kombu_ssl_certfile) and ! is_service_default($kombu_ssl_keyfile)) or (is_service_default($kombu_ssl_keyfile) and ! is_service_default($kombu_ssl_certfile)) {
fail('The kombu_ssl_certfile and kombu_ssl_keyfile parameters must be used together')
}
if ! is_service_default($kombu_missing_consumer_retry_timeout) and ! is_service_default($rpc_response_timeout) and ($kombu_missing_consumer_retry_timeout > $rpc_response_timeout) {
warning('kombu_missing_consumer_retry_timeout should not be longer than rpc_response_timeout')
}
if $memcache_servers {
validate_array($memcache_servers)
@ -459,6 +472,9 @@ class neutron (
heartbeat_rate => $rabbit_heartbeat_rate,
rabbit_use_ssl => $rabbit_use_ssl,
kombu_reconnect_delay => $kombu_reconnect_delay,
kombu_missing_consumer_retry_timeout => $kombu_missing_consumer_retry_timeout,
kombu_failover_strategy => $kombu_failover_strategy,
kombu_compression => $kombu_compression,
kombu_ssl_ca_certs => $kombu_ssl_ca_certs,
kombu_ssl_certfile => $kombu_ssl_certfile,
kombu_ssl_keyfile => $kombu_ssl_keyfile,

View File

@ -0,0 +1,4 @@
---
features:
- Added additional kombu options which are supported by puppet-oslo module
Removed unneeded validation checks (covered by puppet-oslo)

View File

@ -72,7 +72,6 @@ describe 'neutron' do
it_configures 'with SSL enabled with kombu'
it_configures 'with SSL enabled without kombu'
it_configures 'with SSL disabled'
it_configures 'with SSL wrongly configured'
it_configures 'with SSL and kombu wrongly configured'
it_configures 'with SSL socket options set'
it_configures 'with SSL socket options set with wrong parameters'
@ -120,6 +119,9 @@ describe 'neutron' do
is_expected.to contain_neutron_config('oslo_messaging_rabbit/heartbeat_timeout_threshold').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('oslo_messaging_rabbit/heartbeat_rate').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('oslo_messaging_rabbit/kombu_reconnect_delay').with_value( '<SERVICE DEFAULT>' )
is_expected.to contain_neutron_config('oslo_messaging_rabbit/kombu_missing_consumer_retry_timeout').with_value( '<SERVICE DEFAULT>' )
is_expected.to contain_neutron_config('oslo_messaging_rabbit/kombu_failover_strategy').with_value( '<SERVICE DEFAULT>' )
is_expected.to contain_neutron_config('oslo_messaging_rabbit/kombu_compression').with_value( '<SERVICE DEFAULT>' )
end
it 'configures neutron.conf' do
@ -266,6 +268,24 @@ describe 'neutron' do
it { is_expected.to contain_neutron_config('DEFAULT/use_syslog').with_value(false) }
end
shared_examples_for 'with non-default kombu options' do
before do
params.merge!(
:kombu_missing_consumer_retry_timeout => '5',
:kombu_failover_strategy => 'shuffle',
:kombu_compression => 'gzip',
:kombu_reconnect_delay => '30',
)
end
it do
is_expected.to contain_neutron_config('oslo_messaging_rabbit/kombu_reconnect_delay').with_value('30')
is_expected.to contain_neutron_config('oslo_messaging_rabbit/kombu_missing_consumer_retry_timeout').with_value('5')
is_expected.to contain_neutron_config('oslo_messaging_rabbit/kombu_failover_strategy').with_value('shuffle')
is_expected.to contain_neutron_config('oslo_messaging_rabbit/kombu_compression').with_value('gzip')
end
end
shared_examples_for 'with SSL enabled with kombu' do
before do
params.merge!(
@ -313,33 +333,6 @@ describe 'neutron' do
end
end
shared_examples_for 'with SSL wrongly configured' do
before do
params.merge!(
:rabbit_use_ssl => false
)
end
context 'with SSL disabled' do
context 'with kombu_ssl_ca_certs parameter' do
before { params.merge!(:kombu_ssl_ca_certs => '/path/to/ssl/ca/certs') }
it_raises 'a Puppet::Error', /The kombu_ssl_ca_certs parameter requires rabbit_use_ssl to be set to true/
end
context 'with kombu_ssl_certfile parameter' do
before { params.merge!(:kombu_ssl_certfile => '/path/to/ssl/cert/file') }
it_raises 'a Puppet::Error', /The kombu_ssl_certfile parameter requires rabbit_use_ssl to be set to true/
end
context 'with kombu_ssl_keyfile parameter' do
before { params.merge!(:kombu_ssl_keyfile => '/path/to/ssl/keyfile') }
it_raises 'a Puppet::Error', /The kombu_ssl_keyfile parameter requires rabbit_use_ssl to be set to true/
end
end
end
shared_examples_for 'with SSL and kombu wrongly configured' do
before do
params.merge!(