Add control_exchange and rpc_response_timeout options

Add control_exchange to configure an exchange name for message.
Add rpc_response_timeout to configure seconds time for waiting
for a response from a call.

Change-Id: I400b562f0b0d52f6d47e027fb2f12fab63cf511e
This commit is contained in:
ZhongShengping 2017-02-06 11:11:51 +08:00
parent f8801e28fb
commit 8bbe766a70
3 changed files with 36 additions and 9 deletions

View File

@ -23,6 +23,16 @@
# transport://user:pass@host1:port[,hostN:portN]/virtual_host
# Defaults to $::os_service_default
#
# [*rpc_response_timeout*]
# (Optional) Seconds to wait for a response from a call.
# Defaults to $::os_service_default
#
# [*control_exchange*]
# (Optional) The default exchange under which topics are scoped. May be
# overridden by an exchange name specified in the transport_url
# option.
# Defaults to $::os_service_default
#
# [*rabbit_use_ssl*]
# (Optional) Connect over SSL for rabbit
# Defaults to $::os_service_default
@ -81,6 +91,8 @@ class magnum(
$notification_driver = $::os_service_default,
$rpc_backend = 'rabbit',
$default_transport_url = $::os_service_default,
$rpc_response_timeout = $::os_service_default,
$control_exchange = $::os_service_default,
$rabbit_use_ssl = $::os_service_default,
$kombu_ssl_ca_certs = $::os_service_default,
$kombu_ssl_certfile = $::os_service_default,
@ -136,7 +148,9 @@ class magnum(
}
oslo::messaging::default { 'magnum_config':
transport_url => $default_transport_url,
transport_url => $default_transport_url,
rpc_response_timeout => $rpc_response_timeout,
control_exchange => $control_exchange,
}
oslo::messaging::notifications { 'magnum_config':

View File

@ -0,0 +1,7 @@
---
features:
- Add new parameter "control_exchange", the default exchange under
which topics are scoped. May be overridden by an exchange name
specified in the transport_url option.
- Add new parameter "rpc_response_timeout", seconds to wait for a
response from a call

View File

@ -40,6 +40,8 @@ describe 'magnum' do
it 'configures rabbit' do
is_expected.to contain_magnum_config('DEFAULT/rpc_backend').with_value('rabbit')
is_expected.to contain_magnum_config('DEFAULT/transport_url').with_value('<SERVICE DEFAULT>')
is_expected.to contain_magnum_config('DEFAULT/rpc_response_timeout').with_value('<SERVICE DEFAULT>')
is_expected.to contain_magnum_config('DEFAULT/control_exchange').with_value('<SERVICE DEFAULT>')
is_expected.to contain_magnum_config('oslo_messaging_rabbit/rabbit_host').with_value('<SERVICE_DEFAULT>')
is_expected.to contain_magnum_config('oslo_messaging_rabbit/rabbit_password').with_value('<SERVICE_DEFAULT>').with_secret(true)
is_expected.to contain_magnum_config('oslo_messaging_rabbit/rabbit_port').with_value('<SERVICE_DEFAULT>')
@ -55,14 +57,16 @@ describe 'magnum' do
context 'with overridden parameters' do
let :params do
{ :package_ensure => 'latest',
:notification_driver => 'messagingv1',
:transport_url => 'rabbit://user:pass@host:1234/virt',
:rabbit_host => '53.210.103.65',
:rabbit_port => '1234',
:rabbit_userid => 'me',
:rabbit_password => 'secrete',
:rabbit_virtual_host => 'vhost',
{ :package_ensure => 'latest',
:notification_driver => 'messagingv1',
:transport_url => 'rabbit://user:pass@host:1234/virt',
:rpc_response_timeout => '120',
:control_exchange => 'magnum',
:rabbit_host => '53.210.103.65',
:rabbit_port => '1234',
:rabbit_userid => 'me',
:rabbit_password => 'secrete',
:rabbit_virtual_host => 'vhost',
}
end
@ -76,6 +80,8 @@ describe 'magnum' do
it 'configures rabbit' do
is_expected.to contain_magnum_config('DEFAULT/transport_url').with_value('rabbit://user:pass@host:1234/virt')
is_expected.to contain_magnum_config('DEFAULT/rpc_response_timeout').with_value('120')
is_expected.to contain_magnum_config('DEFAULT/control_exchange').with_value('magnum')
is_expected.to contain_magnum_config('oslo_messaging_rabbit/rabbit_host').with_value('53.210.103.65')
is_expected.to contain_magnum_config('oslo_messaging_rabbit/rabbit_password').with_value('secrete').with_secret(true)
is_expected.to contain_magnum_config('oslo_messaging_rabbit/rabbit_port').with_value('1234')