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: If5f30ba1944d897d2dd63539f4bb8a80e6c46c5e
This commit is contained in:
Andrew Smith 2016-05-31 14:48:03 -04:00
parent 0dd0534bc5
commit f8185bb497
5 changed files with 40 additions and 4 deletions

View File

@ -5,6 +5,12 @@
# #
# === Parameters # === Parameters
# #
# [*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*] # [*notification_driver*]
# (option) Driver or drivers to handle sending notifications. # (option) Driver or drivers to handle sending notifications.
# The default value of 'messagingv2' is for enabling notifications via # The default value of 'messagingv2' is for enabling notifications via
@ -14,10 +20,12 @@
# was adopted in icehouse/juno. See LP#1425713. # was adopted in icehouse/juno. See LP#1425713.
# #
class cinder::ceilometer ( class cinder::ceilometer (
$notification_driver = 'messagingv2', $notification_transport_url = $::os_service_default,
$notification_driver = 'messagingv2',
) { ) {
oslo::messaging::notifications { 'cinder_config': oslo::messaging::notifications { 'cinder_config':
driver => $notification_driver transport_url => $notification_transport_url,
driver => $notification_driver,
} }
} }

View File

@ -13,6 +13,12 @@
# (Optional) Should the daemons log debug messages # (Optional) Should the daemons log debug messages
# Defaults to undef. # Defaults to undef.
# #
# [*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*] # [*rpc_backend*]
# (Optional) Use these options to configure the RabbitMQ message system. # (Optional) Use these options to configure the RabbitMQ message system.
# Defaults to 'rabbit' # Defaults to 'rabbit'
@ -301,6 +307,7 @@ class cinder (
$database_max_retries = undef, $database_max_retries = undef,
$database_retry_interval = undef, $database_retry_interval = undef,
$database_max_overflow = undef, $database_max_overflow = undef,
$default_transport_url = $::os_service_default,
$rpc_backend = 'rabbit', $rpc_backend = 'rabbit',
$control_exchange = 'openstack', $control_exchange = 'openstack',
$rabbit_host = $::os_service_default, $rabbit_host = $::os_service_default,
@ -454,7 +461,8 @@ class cinder (
} }
oslo::messaging::default { 'cinder_config': oslo::messaging::default { 'cinder_config':
control_exchange => $control_exchange transport_url => $default_transport_url,
control_exchange => $control_exchange,
} }
if ! $default_availability_zone { if ! $default_availability_zone {

View File

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

View File

@ -1,9 +1,15 @@
require 'spec_helper' require 'spec_helper'
describe 'cinder::ceilometer' do describe 'cinder::ceilometer' do
describe 'with default parameters' do describe 'with default parameters' do
let :facts do
OSDefaults.get_facts({})
end
it 'contains default values' do it 'contains default values' do
is_expected.to contain_cinder_config('oslo_messaging_notifications/transport_url').with(
:value => '<SERVICE DEFAULT>')
is_expected.to contain_cinder_config('oslo_messaging_notifications/driver').with( is_expected.to contain_cinder_config('oslo_messaging_notifications/driver').with(
:value => 'messagingv2') :value => 'messagingv2')
end end

View File

@ -32,6 +32,7 @@ describe 'cinder' do
end end
it 'should contain default config' do it 'should contain default config' do
is_expected.to contain_cinder_config('DEFAULT/transport_url').with(:value => '<SERVICE DEFAULT>')
is_expected.to contain_cinder_config('DEFAULT/rpc_backend').with(:value => 'rabbit') is_expected.to contain_cinder_config('DEFAULT/rpc_backend').with(:value => 'rabbit')
is_expected.to contain_cinder_config('DEFAULT/control_exchange').with(:value => 'openstack') is_expected.to contain_cinder_config('DEFAULT/control_exchange').with(:value => 'openstack')
is_expected.to contain_cinder_config('DEFAULT/report_interval').with(:value => '<SERVICE DEFAULT>') is_expected.to contain_cinder_config('DEFAULT/report_interval').with(:value => '<SERVICE DEFAULT>')
@ -329,4 +330,14 @@ describe 'cinder' do
it { is_expected.to contain_cinder_config('DEFAULT/host').with_value('mystring') } it { is_expected.to contain_cinder_config('DEFAULT/host').with_value('mystring') }
end end
describe 'with transport_url' do
let :params do
req_params.merge({
:default_transport_url => 'rabbit://rabbit_user:password@localhost:5673',
})
end
it { is_expected.to contain_cinder_config('DEFAULT/transport_url').with_value('rabbit://rabbit_user:password@localhost:5673') }
end
end end