Add transport_url parameter for oslo.messaging

This commit adds the transport_url parameter for oslo.messaging. The
url is of the form:

  transport://user:pass@host1:port[,hostN:portN]/virtual_host

Where the transport scheme specifies the rpc or notification backend
as one of rabbit, amqp, zmq, etc. Oslo.messaging is deprecating the
host, port, and auth configuration options [1]. All drivers will get
these options via the transport_url.

This patch:
* use oslo::messaging::default resource
* add parameter for transport_url
* update spec test
* add feature release note

[1] https://review.openstack.org/#/c/317285/

Change-Id: I210c2c6c87600f3bd92e23d23b630f297220e091
This commit is contained in:
Andrew Smith 2016-05-27 10:48:33 -04:00
parent f77ef0ec65
commit df77db2909
3 changed files with 29 additions and 2 deletions

View File

@ -120,7 +120,13 @@
# [*control_exchange*]
# (optional) What RPC queue/exchange to use
# Defaults to neutron
#
# [*default_transport_url*]
# (optional) A URL representing the messaging driver to use and its full
# configuration. Transport URLs take the form:
# transport://user:pass@host1:port[,hostN:portN]/virtual_host
# Defaults to $::os_service_default
#
# [*rpc_backend*]
# (optional) what rpc/queuing service to use
# Defaults to $::os_service_default
@ -340,7 +346,9 @@
#
# [*notification_transport_url*]
# (optional) A URL representing the messaging driver to use for
# notifications.
# notifications and its full configuration. Transport URLs
# take the form:
# transport://user:pass@host1:port[,hostN:portN]/virtual_host
# Defaults to $::os_service_default.
#
# DEPRECATED PARAMETERS
@ -385,6 +393,7 @@ class neutron (
$report_interval = $::os_service_default,
$memcache_servers = false,
$control_exchange = 'neutron',
$default_transport_url = $::os_service_default,
$rpc_backend = $::os_service_default,
$rpc_response_timeout = $::os_service_default,
$rabbit_password = $::os_service_default,
@ -523,6 +532,7 @@ class neutron (
}
oslo::messaging::default { 'neutron_config':
transport_url => $default_transport_url,
rpc_response_timeout => $rpc_response_timeout,
control_exchange => $control_exchange
}

View File

@ -0,0 +1,3 @@
---
features:
- Add oslo.messaging transport_url parameter via puppet-oslo resource

View File

@ -82,6 +82,7 @@ describe 'neutron' do
it_configures 'without memcache_servers'
it_configures 'with memcache_servers'
it_configures 'with dns_domain defined'
it_configures 'with transport_url defined'
context 'with amqp rpc_backend value' do
it_configures 'amqp support'
@ -146,6 +147,7 @@ describe 'neutron' do
is_expected.to contain_neutron_config('DEFAULT/control_exchange').with_value('neutron')
is_expected.to contain_neutron_config('DEFAULT/state_path').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('oslo_concurrency/lock_path').with_value('$state_path/lock')
is_expected.to contain_neutron_config('DEFAULT/transport_url').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('DEFAULT/rpc_response_timeout').with_value( '<SERVICE DEFAULT>' )
is_expected.to contain_neutron_config('agent/root_helper').with_value('sudo neutron-rootwrap /etc/neutron/rootwrap.conf')
is_expected.to contain_neutron_config('agent/report_interval').with_value('<SERVICE DEFAULT>')
@ -450,6 +452,18 @@ describe 'neutron' do
end
end
shared_examples_for 'with transport_url defined' do
before do
params.merge!(
:default_transport_url => 'rabbit://rabbit_user:password@localhost:5673'
)
end
it do
is_expected.to contain_neutron_config('DEFAULT/transport_url').with_value(params[:default_transport_url])
end
end
shared_examples_for 'amqp support' do
context 'with default parameters' do
before { params.merge!( :rpc_backend => 'amqp' ) }