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@host:port/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 olso::messaging::notifications resource
* add new parameters for transport_url(s)
* update spec tests for added parameters
* add feature release not

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

Change-Id: If9e028cbcd0db4b8e472cbcd11407807f2a8c198
This commit is contained in:
Andrew Smith 2016-05-23 09:54:19 -04:00
parent 5abb616897
commit 1d2c2e6cc1
3 changed files with 40 additions and 10 deletions

View File

@ -13,6 +13,12 @@
# (<= 0 means forever) # (<= 0 means forever)
# Defaults to $::os_service_default # Defaults to $::os_service_default
# #
# [*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) The rpc backend implementation to use, can be: # (optional) The rpc backend implementation to use, can be:
# amqp (for AMQP 1.0 protocol) # amqp (for AMQP 1.0 protocol)
@ -182,6 +188,12 @@
# (optional) Syslog facility to receive log lines. # (optional) Syslog facility to receive log lines.
# Defaults to undef # Defaults to undef
# #
# [*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*]
# (optional) Driver or drivers to handle sending notifications. # (optional) Driver or drivers to handle sending notifications.
# Value can be a string or a list. # Value can be a string or a list.
@ -240,6 +252,7 @@
class aodh ( class aodh (
$ensure_package = 'present', $ensure_package = 'present',
$alarm_history_time_to_live = $::os_service_default, $alarm_history_time_to_live = $::os_service_default,
$default_transport_url = $::os_service_default,
$rpc_backend = 'rabbit', $rpc_backend = 'rabbit',
$rabbit_host = $::os_service_default, $rabbit_host = $::os_service_default,
$rabbit_hosts = $::os_service_default, $rabbit_hosts = $::os_service_default,
@ -278,6 +291,7 @@ class aodh (
$use_stderr = undef, $use_stderr = undef,
$log_facility = undef, $log_facility = undef,
$log_dir = undef, $log_dir = undef,
$notification_transport_url = $::os_service_default,
$notification_driver = $::os_service_default, $notification_driver = $::os_service_default,
$notification_topics = $::os_service_default, $notification_topics = $::os_service_default,
$database_connection = undef, $database_connection = undef,
@ -353,9 +367,14 @@ class aodh (
} }
} }
oslo::messaging::default { 'aodh_config':
transport_url => $default_transport_url,
}
oslo::messaging::notifications { 'aodh_config': oslo::messaging::notifications { 'aodh_config':
driver => $notification_driver, transport_url => $notification_transport_url,
topics => $notification_topics, driver => $notification_driver,
topics => $notification_topics,
} }
aodh_config { aodh_config {

View File

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

View File

@ -19,6 +19,7 @@ describe 'aodh' do
it 'configures rabbit' do it 'configures rabbit' do
is_expected.to contain_aodh_config('DEFAULT/rpc_backend').with_value('rabbit') is_expected.to contain_aodh_config('DEFAULT/rpc_backend').with_value('rabbit')
is_expected.to contain_aodh_config('DEFAULT/transport_url').with_value('<SERVICE DEFAULT>')
is_expected.to contain_aodh_config('oslo_messaging_rabbit/rabbit_host').with_value('<SERVICE DEFAULT>') is_expected.to contain_aodh_config('oslo_messaging_rabbit/rabbit_host').with_value('<SERVICE DEFAULT>')
is_expected.to contain_aodh_config('oslo_messaging_rabbit/rabbit_password').with_value('<SERVICE DEFAULT>').with_secret(true) is_expected.to contain_aodh_config('oslo_messaging_rabbit/rabbit_password').with_value('<SERVICE DEFAULT>').with_secret(true)
is_expected.to contain_aodh_config('oslo_messaging_rabbit/rabbit_port').with_value('<SERVICE DEFAULT>') is_expected.to contain_aodh_config('oslo_messaging_rabbit/rabbit_port').with_value('<SERVICE DEFAULT>')
@ -27,6 +28,7 @@ describe 'aodh' do
is_expected.to contain_aodh_config('oslo_messaging_rabbit/heartbeat_timeout_threshold').with_value('<SERVICE DEFAULT>') is_expected.to contain_aodh_config('oslo_messaging_rabbit/heartbeat_timeout_threshold').with_value('<SERVICE DEFAULT>')
is_expected.to contain_aodh_config('oslo_messaging_rabbit/heartbeat_rate').with_value('<SERVICE DEFAULT>') is_expected.to contain_aodh_config('oslo_messaging_rabbit/heartbeat_rate').with_value('<SERVICE DEFAULT>')
is_expected.to contain_aodh_config('oslo_messaging_rabbit/kombu_compression').with_value('<SERVICE DEFAULT>') is_expected.to contain_aodh_config('oslo_messaging_rabbit/kombu_compression').with_value('<SERVICE DEFAULT>')
is_expected.to contain_aodh_config('oslo_messaging_notifications/transport_url').with_value('<SERVICE DEFAULT>')
is_expected.to contain_aodh_config('oslo_messaging_notifications/driver').with_value('<SERVICE DEFAULT>') is_expected.to contain_aodh_config('oslo_messaging_notifications/driver').with_value('<SERVICE DEFAULT>')
is_expected.to contain_aodh_config('database/alarm_history_time_to_live').with_value('<SERVICE DEFAULT>') is_expected.to contain_aodh_config('database/alarm_history_time_to_live').with_value('<SERVICE DEFAULT>')
end end
@ -36,6 +38,7 @@ describe 'aodh' do
let :params do let :params do
{ {
:debug => true, :debug => true,
:default_transport_url => 'rabbit://rabbit_user:password@localhost:5673',
:rabbit_host => 'rabbit', :rabbit_host => 'rabbit',
:rabbit_userid => 'rabbit_user', :rabbit_userid => 'rabbit_user',
:rabbit_port => '5673', :rabbit_port => '5673',
@ -46,6 +49,7 @@ describe 'aodh' do
:kombu_compression => 'gzip', :kombu_compression => 'gzip',
:ensure_package => '2012.1.1-15.el6', :ensure_package => '2012.1.1-15.el6',
:gnocchi_url => 'http://127.0.0.1:8041', :gnocchi_url => 'http://127.0.0.1:8041',
:notification_transport_url => 'rabbit://rabbit_user:password@localhost:5673',
:notification_driver => 'ceilometer.compute.aodh_notifier', :notification_driver => 'ceilometer.compute.aodh_notifier',
:notification_topics => 'openstack', :notification_topics => 'openstack',
:alarm_history_time_to_live => '604800', :alarm_history_time_to_live => '604800',
@ -54,6 +58,7 @@ describe 'aodh' do
it 'configures rabbit' do it 'configures rabbit' do
is_expected.to contain_aodh_config('DEFAULT/rpc_backend').with_value('rabbit') is_expected.to contain_aodh_config('DEFAULT/rpc_backend').with_value('rabbit')
is_expected.to contain_aodh_config('DEFAULT/transport_url').with_value('rabbit://rabbit_user:password@localhost:5673')
is_expected.to contain_aodh_config('oslo_messaging_rabbit/rabbit_host').with_value('rabbit') is_expected.to contain_aodh_config('oslo_messaging_rabbit/rabbit_host').with_value('rabbit')
is_expected.to contain_aodh_config('oslo_messaging_rabbit/rabbit_password').with_value('password').with_secret(true) is_expected.to contain_aodh_config('oslo_messaging_rabbit/rabbit_password').with_value('password').with_secret(true)
is_expected.to contain_aodh_config('oslo_messaging_rabbit/rabbit_port').with_value('5673') is_expected.to contain_aodh_config('oslo_messaging_rabbit/rabbit_port').with_value('5673')
@ -66,6 +71,7 @@ describe 'aodh' do
end end
it 'configures various things' do it 'configures various things' do
is_expected.to contain_aodh_config('oslo_messaging_notifications/transport_url').with_value('rabbit://rabbit_user:password@localhost:5673')
is_expected.to contain_aodh_config('oslo_messaging_notifications/driver').with_value('ceilometer.compute.aodh_notifier') is_expected.to contain_aodh_config('oslo_messaging_notifications/driver').with_value('ceilometer.compute.aodh_notifier')
is_expected.to contain_aodh_config('oslo_messaging_notifications/topics').with_value('openstack') is_expected.to contain_aodh_config('oslo_messaging_notifications/topics').with_value('openstack')
is_expected.to contain_aodh_config('DEFAULT/gnocchi_url').with_value('http://127.0.0.1:8041') is_expected.to contain_aodh_config('DEFAULT/gnocchi_url').with_value('http://127.0.0.1:8041')
@ -224,19 +230,21 @@ describe 'aodh' do
context 'with overriden amqp parameters' do context 'with overriden amqp parameters' do
let :params do let :params do
{ :rpc_backend => 'amqp', { :rpc_backend => 'amqp',
:amqp_idle_timeout => '60', :default_transport_url => 'amqp://amqp_user:password@localhost:5672',
:amqp_trace => true, :amqp_idle_timeout => '60',
:amqp_ssl_ca_file => '/etc/ca.cert', :amqp_trace => true,
:amqp_ssl_cert_file => '/etc/certfile', :amqp_ssl_ca_file => '/etc/ca.cert',
:amqp_ssl_key_file => '/etc/key', :amqp_ssl_cert_file => '/etc/certfile',
:amqp_username => 'amqp_user', :amqp_ssl_key_file => '/etc/key',
:amqp_password => 'password', :amqp_username => 'amqp_user',
:amqp_password => 'password',
} }
end end
it 'configures amqp' do it 'configures amqp' do
is_expected.to contain_aodh_config('DEFAULT/rpc_backend').with_value('amqp') is_expected.to contain_aodh_config('DEFAULT/rpc_backend').with_value('amqp')
is_expected.to contain_aodh_config('DEFAULT/transport_url').with_value('amqp://amqp_user:password@localhost:5672')
is_expected.to contain_aodh_config('oslo_messaging_amqp/idle_timeout').with_value('60') is_expected.to contain_aodh_config('oslo_messaging_amqp/idle_timeout').with_value('60')
is_expected.to contain_aodh_config('oslo_messaging_amqp/trace').with_value('true') is_expected.to contain_aodh_config('oslo_messaging_amqp/trace').with_value('true')
is_expected.to contain_aodh_config('oslo_messaging_amqp/ssl_ca_file').with_value('/etc/ca.cert') is_expected.to contain_aodh_config('oslo_messaging_amqp/ssl_ca_file').with_value('/etc/ca.cert')