Browse Source

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: Iaaae758ffc6866e94c63251d2c9bd4af086f32cc
changes/13/322913/1
Andrew Smith 6 years ago
parent
commit
39076721e1
  1. 23
      manifests/init.pp
  2. 3
      releasenotes/notes/add_transport_url_parameters-8c4c520e5cce0edc.yaml
  3. 27
      spec/classes/ceilometer_init_spec.rb

23
manifests/init.pp

@ -47,6 +47,18 @@
# (Optional) Syslog facility to receive log lines.
# 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
#
# [*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
#
# [*rpc_backend*]
# The messaging driver to use, defaults to rabbit. Other drivers include
# amqp and zmq. (string value)
@ -227,6 +239,8 @@ class ceilometer(
$log_dir = undef,
$use_stderr = undef,
$log_facility = undef,
$default_transport_url = $::os_service_default,
$notification_transport_url = $::os_service_default,
$rpc_backend = $::os_service_default,
$rabbit_host = $::os_service_default,
$rabbit_port = $::os_service_default,
@ -369,7 +383,14 @@ class ceilometer(
'database/metering_time_to_live' : value => $metering_time_to_live;
}
oslo::messaging::notifications { 'ceilometer_config': topics => $notification_topics }
oslo::messaging::notifications { 'ceilometer_config':
transport_url => $notification_transport_url,
topics => $notification_topics,
}
oslo::messaging::default { 'ceilometer_config':
transport_url => $default_transport_url,
}
oslo::cache { 'ceilometer_config':
memcache_servers => $memcached_servers,

3
releasenotes/notes/add_transport_url_parameters-8c4c520e5cce0edc.yaml

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

27
spec/classes/ceilometer_init_spec.rb

@ -115,8 +115,13 @@ describe 'ceilometer' do
it { expect { is_expected.to raise_error(Puppet::Error) } }
end
it 'configures notification_topics' do
it 'configures default transport_url' do
is_expected.to contain_ceilometer_config('DEFAULT/transport_url').with_value('<SERVICE DEFAULT>')
end
it 'configures notifications' do
is_expected.to contain_ceilometer_config('oslo_messaging_notifications/topics').with_value('notifications')
is_expected.to contain_ceilometer_config('oslo_messaging_notifications/transport_url').with_value('<SERVICE DEFAULT>')
end
context 'with rabbitmq durable queues configured' do
@ -124,11 +129,25 @@ describe 'ceilometer' do
it_configures 'rabbit with durable queues'
end
context 'with overriden notification_topics parameter' do
before { params.merge!( :notification_topics => ['notifications', 'custom']) }
context 'with overriden transport_url parameter' do
before { params.merge!( :default_transport_url => 'rabbit://rabbit_user:password@localhost:5673' ) }
it 'configures transport_url' do
is_expected.to contain_ceilometer_config('DEFAULT/transport_url').with_value('rabbit://rabbit_user:password@localhost:5673')
end
end
context 'with overriden notification parameters' do
before {
params.merge!(
:notification_topics => ['notifications', 'custom'],
:notification_transport_url => 'rabbit://rabbit_user:password@localhost:5673',
)
}
it 'configures notification_topics' do
it 'configures notifications' do
is_expected.to contain_ceilometer_config('oslo_messaging_notifications/topics').with_value('notifications,custom')
is_expected.to contain_ceilometer_config('oslo_messaging_notifications/transport_url').with_value('rabbit://rabbit_user:password@localhost:5673')
end
end
end

Loading…
Cancel
Save