Move cinder::ceilometer to init
The cinder module is the only module that has a class named ceilometer to configure the oslo notifications section. The majority of our modules has these parameters in the init class except for a few, to make it more consistent and to not use another projects name as a class name to configure something that is not explicitly only for that usecase. Change-Id: Ic45e50cf8cd19ee197da12006030abdc064ae9de
This commit is contained in:
parent
0973f28597
commit
a825f85032
@ -1,5 +1,6 @@
|
||||
# == Class: cinder::ceilometer
|
||||
#
|
||||
# DEPRECATED!
|
||||
# Setup Cinder to enable ceilometer can retrieve volume samples
|
||||
#
|
||||
# === Parameters
|
||||
@ -8,27 +9,21 @@
|
||||
# (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
|
||||
# Defaults to undef
|
||||
#
|
||||
# [*notification_driver*]
|
||||
# (Option) Driver or drivers to handle sending notifications.
|
||||
# Defaults to 'messagingv2'
|
||||
# Defaults to undef
|
||||
#
|
||||
# [*notification_topics*]
|
||||
# (Optional) AMQP topic used for OpenStack notifications
|
||||
# Defaults to $::os_service_default
|
||||
# Defaults to undef
|
||||
#
|
||||
class cinder::ceilometer (
|
||||
$notification_transport_url = $::os_service_default,
|
||||
$notification_driver = 'messagingv2',
|
||||
$notification_topics = $::os_service_default,
|
||||
$notification_transport_url = undef,
|
||||
$notification_driver = undef,
|
||||
$notification_topics = undef,
|
||||
) {
|
||||
|
||||
include cinder::deps
|
||||
|
||||
oslo::messaging::notifications { 'cinder_config':
|
||||
transport_url => $notification_transport_url,
|
||||
driver => $notification_driver,
|
||||
topics => $notification_topics,
|
||||
}
|
||||
warning('cinder::ceilometer is deprecated and has no effect')
|
||||
}
|
||||
|
@ -22,6 +22,20 @@
|
||||
# (Optional)
|
||||
# Defaults to 'openstack'.
|
||||
#
|
||||
# [*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*]
|
||||
# (Option) Driver or drivers to handle sending notifications.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*notification_topics*]
|
||||
# (Optional) AMQP topic used for OpenStack notifications
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*rabbit_ha_queues*]
|
||||
# (optional) Use HA queues in RabbitMQ (x-ha-policy: all).
|
||||
# Defaults to $::os_service_default
|
||||
@ -261,6 +275,9 @@ class cinder (
|
||||
$default_transport_url = $::os_service_default,
|
||||
$rpc_response_timeout = $::os_service_default,
|
||||
$control_exchange = 'openstack',
|
||||
$notification_transport_url = $::os_service_default,
|
||||
$notification_driver = $::os_service_default,
|
||||
$notification_topics = $::os_service_default,
|
||||
$rabbit_ha_queues = $::os_service_default,
|
||||
$rabbit_heartbeat_timeout_threshold = $::os_service_default,
|
||||
$rabbit_heartbeat_rate = $::os_service_default,
|
||||
@ -362,6 +379,20 @@ class cinder (
|
||||
control_exchange => $control_exchange,
|
||||
}
|
||||
|
||||
# TODO(tobias-urdin): Remove pick's when cinder::ceilometer is removed.
|
||||
$notification_transport_url_real = pick($cinder::ceilometer::notification_transport_url,
|
||||
$notification_transport_url)
|
||||
$notification_driver_real = pick($cinder::ceilometer::notification_driver,
|
||||
$notification_driver)
|
||||
$notification_topics_real = pick($cinder::ceilometer::notification_topics,
|
||||
$notification_topics)
|
||||
|
||||
oslo::messaging::notifications { 'cinder_config':
|
||||
transport_url => $notification_transport_url_real,
|
||||
driver => $notification_driver_real,
|
||||
topics => $notification_topics_real,
|
||||
}
|
||||
|
||||
if ! $default_availability_zone {
|
||||
$default_availability_zone_real = $storage_availability_zone
|
||||
} else {
|
||||
|
@ -0,0 +1,12 @@
|
||||
---
|
||||
upgrade:
|
||||
- |
|
||||
The cinder::ceilometer class is deprecated and has no effect. The parameters
|
||||
notification_transport_url, notification_driver and notification_topics has
|
||||
been moved to the cinder class. The default value of notification_driver has
|
||||
been changed, you need to explicitly set it to messagingv2 or another driver
|
||||
that you want to use.
|
||||
deprecations:
|
||||
- |
|
||||
The cinder::ceilometer class is deprecated and has no effect. The parameters
|
||||
for this class has been moved to the cinder class.
|
@ -1,23 +0,0 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'cinder::ceilometer' do
|
||||
shared_examples 'cinder::ceilometer' do
|
||||
context 'with default parameters' do
|
||||
it { is_expected.to contain_cinder_config('oslo_messaging_notifications/transport_url').with_value('<SERVICE DEFAULT>') }
|
||||
it { is_expected.to contain_cinder_config('oslo_messaging_notifications/driver').with_value('messagingv2') }
|
||||
it { is_expected.to contain_cinder_config('oslo_messaging_notifications/topics').with_value('<SERVICE DEFAULT>') }
|
||||
end
|
||||
end
|
||||
|
||||
on_supported_os({
|
||||
:supported_os => OSDefaults.get_supported_os
|
||||
}).each do |os,facts|
|
||||
context "on #{os}" do
|
||||
let (:facts) do
|
||||
facts.merge!(OSDefaults.get_facts())
|
||||
end
|
||||
|
||||
it_behaves_like 'cinder::ceilometer'
|
||||
end
|
||||
end
|
||||
end
|
@ -23,6 +23,15 @@ describe 'cinder' do
|
||||
is_expected.to contain_cinder_config('DEFAULT/transport_url').with(:value => '<SERVICE DEFAULT>')
|
||||
is_expected.to contain_cinder_config('DEFAULT/rpc_response_timeout').with(:value => '<SERVICE DEFAULT>')
|
||||
is_expected.to contain_cinder_config('DEFAULT/control_exchange').with(:value => 'openstack')
|
||||
}
|
||||
|
||||
it { is_expected.to contain_oslo__messaging__notifications('cinder_config').with(
|
||||
:transport_url => '<SERVICE DEFAULT>',
|
||||
:driver => '<SERVICE DEFAULT>',
|
||||
:topics => '<SERVICE DEFAULT>',
|
||||
)}
|
||||
|
||||
it {
|
||||
is_expected.to contain_cinder_config('DEFAULT/report_interval').with(:value => '<SERVICE DEFAULT>')
|
||||
is_expected.to contain_cinder_config('DEFAULT/service_down_time').with(:value => '<SERVICE DEFAULT>')
|
||||
is_expected.to contain_cinder_config('oslo_messaging_rabbit/rabbit_ha_queues').with(:value => '<SERVICE DEFAULT>')
|
||||
@ -249,6 +258,22 @@ describe 'cinder' do
|
||||
|
||||
it { is_expected.to contain_cinder_config('DEFAULT/transport_url').with_value('rabbit://rabbit_user:password@localhost:5673') }
|
||||
end
|
||||
|
||||
context 'with notifications' do
|
||||
let :params do
|
||||
req_params.merge({
|
||||
:notification_transport_url => 'rabbit://notif_user:password@localhost:5673',
|
||||
:notification_driver => 'messagingv2',
|
||||
:notification_topics => 'test',
|
||||
})
|
||||
end
|
||||
|
||||
it { is_expected.to contain_oslo__messaging__notifications('cinder_config').with(
|
||||
:transport_url => params[:notification_transport_url],
|
||||
:driver => params[:notification_driver],
|
||||
:topics => params[:notification_topics],
|
||||
)}
|
||||
end
|
||||
end
|
||||
|
||||
on_supported_os({
|
||||
|
Loading…
Reference in New Issue
Block a user