Add transport_url parameters for oslo.messaging

This commit adds the transport_url parameters 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
* use oslo::messaging::notifications resource
* add parameters for transport_url(s)
* update spec tests
* add feature release note

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

Change-Id: I6f58a4da46a44ec20b256f08108b3b045f1c55ee
This commit is contained in:
Andrew Smith 2016-05-31 16:43:56 -04:00
parent e95a95324c
commit 68494cfa06
3 changed files with 44 additions and 5 deletions

View File

@ -35,6 +35,12 @@
# (optional) Directory for storing state.
# Defaults to '/var/lib/manila'
#
# [*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
#
# [*control_exchange*]
# (Optional) The default exchange under which topics are scope.
# Defaults to 'openstack'.
@ -47,6 +53,13 @@
# (Optional) Ensure state for package.
# Defaults to 'present'
#
# [*notification_transport_url*]
# (optional) A URL representing the messaging driver to use for
# notifications and its full configuration. Transport URLs
# take the form:
# transport://user:pass@host1:port[,hostN:portN]/virtual_host
# Defaults to $::os_service_default.
#
# [*notification_driver*]
# (optional) Driver or drivers to handle sending notifications.
# Defaults to 'messaging'
@ -237,7 +250,9 @@ class manila (
$database_max_pool_size = undef,
$database_max_overflow = undef,
$rpc_backend = 'rabbit',
$default_transport_url = $::os_service_default,
$control_exchange = 'openstack',
$notification_transport_url = $::os_service_default,
$notification_driver = 'messaging',
$rabbit_host = $::os_service_default,
$rabbit_port = $::os_service_default,
@ -335,10 +350,6 @@ class manila (
kombu_ssl_keyfile => $kombu_ssl_keyfile,
kombu_ssl_version => $kombu_ssl_version,
}
oslo::messaging::notifications { 'manila_config':
driver => $notification_driver
}
}
elsif $rpc_backend == 'amqp' {
@ -364,7 +375,13 @@ class manila (
}
oslo::messaging::default { 'manila_config':
control_exchange => $control_exchange
transport_url => $default_transport_url,
control_exchange => $control_exchange,
}
oslo::messaging::notifications { 'manila_config':
transport_url => $notification_transport_url,
driver => $notification_driver,
}
manila_config {

View File

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

View File

@ -20,6 +20,12 @@ describe 'manila' do
is_expected.to contain_manila_config('DEFAULT/rpc_backend').with(
:value => 'rabbit'
)
is_expected.to contain_manila_config('DEFAULT/transport_url').with(
:value => '<SERVICE DEFAULT>'
)
is_expected.to contain_manila_config('oslo_messaging_notifications/transport_url').with(
:value => '<SERVICE DEFAULT>'
)
is_expected.to contain_manila_config('oslo_messaging_notifications/driver').with(
:value => 'messaging'
)
@ -257,6 +263,19 @@ describe 'manila' do
it_raises 'a Puppet::Error', /The cert_file parameter is required when use_ssl is set to true/
end
describe 'with transport_url entries' do
let :params do
{
:default_transport_url => 'rabbit://rabbit_user:password@localhost:5673',
:notification_transport_url => 'rabbit://rabbit_user:password@localhost:5673',
}
end
it { is_expected.to contain_manila_config('DEFAULT/transport_url').with_value('rabbit://rabbit_user:password@localhost:5673') }
it { is_expected.to contain_manila_config('oslo_messaging_notifications/transport_url').with_value('rabbit://rabbit_user:password@localhost:5673') }
end
describe 'with amqp rpc supplied' do
let :params do