Add notification_driver option

Add notification_driver to configure driver or drivers for handling
sending notifications.

Change-Id: Id6450967f8efd30597b0b3a23602fa8d673aec8a
This commit is contained in:
ZhongShengping 2017-02-13 17:39:44 +08:00
parent 840efb3bd6
commit c3d330eeb5
3 changed files with 74 additions and 60 deletions

View File

@ -5,61 +5,66 @@
# #
# === Parameters: # === Parameters:
# #
# [*http_timeout*] # [*http_timeout*]
# (Optional) Timeout seconds for HTTP requests. # (Optional) Timeout seconds for HTTP requests.
# Defaults to 600. # Defaults to 600.
# #
# [*event_time_to_live*] # [*event_time_to_live*]
# (Optional) Number of seconds that events are kept in the database for # (Optional) Number of seconds that events are kept in the database for
# (<= 0 means forever) # (<= 0 means forever)
# Defaults to -1. # Defaults to -1.
# #
# [*metering_time_to_live*] # [*metering_time_to_live*]
# (Optional) Number of seconds that samples are kept in the database for # (Optional) Number of seconds that samples are kept in the database for
# (<= 0 means forever) # (<= 0 means forever)
# Defaults to -1. # Defaults to -1.
# #
# [*telemetry_secret*] # [*telemetry_secret*]
# (Required) Secret key for signing messages. # (Required) Secret key for signing messages.
# #
# [*notification_topics*] # [*notification_topics*]
# (Optional) AMQP topic used for OpenStack notifications (list value) # (Optional) AMQP topic used for OpenStack notifications (list value)
# Defaults to 'notifications'. # Defaults to 'notifications'.
# #
# [*package_ensure*] # [*notification_driver*]
# (Optional) ensure state for package. # (optional) Driver or drivers to handle sending notifications.
# Defaults to 'present'. # Value can be a string or a list.
# Defaults to $::os_service_default
# #
# [*debug*] # [*package_ensure*]
# (Optional) Should the daemons log debug messages. # (Optional) ensure state for package.
# Defaults to undef. # Defaults to 'present'.
# #
# [*log_dir*] # [*debug*]
# (Optional) Directory to which ceilometer logs are sent. # (Optional) Should the daemons log debug messages.
# If set to $::os_service_default, it will not log to any directory. # Defaults to undef.
# Defaults to undef.
# #
# [*use_syslog*] # [*log_dir*]
# (Optional) Use syslog for logging # (Optional) Directory to which ceilometer logs are sent.
# Defaults to undef. # If set to $::os_service_default, it will not log to any directory.
# Defaults to undef.
# #
# [*use_stderr*] # [*use_syslog*]
# (Optional) Use stderr for logging # (Optional) Use syslog for logging
# Defaults to undef. # Defaults to undef.
# #
# [*log_facility*] # [*use_stderr*]
# (Optional) Syslog facility to receive log lines. # (Optional) Use stderr for logging
# Defaults to undef. # Defaults to undef.
#
# [*log_facility*]
# (Optional) Syslog facility to receive log lines.
# Defaults to undef.
# #
# [*default_transport_url*] # [*default_transport_url*]
# (optional) A URL representing the messaging driver to use and its full # (optional) A URL representing the messaging driver to use and its full
# configuration. Transport URLs take the form: # configuration. Transport URLs take the form:
# transport://user:pass@host1:port[,hostN:portN]/virtual_host # transport://user:pass@host1:port[,hostN:portN]/virtual_host
# Defaults to $::os_service_default # Defaults to $::os_service_default
# #
# [*rpc_response_timeout*] # [*rpc_response_timeout*]
# (Optional) Seconds to wait for a response from a call. # (Optional) Seconds to wait for a response from a call.
# Defaults to $::os_service_default # Defaults to $::os_service_default
# #
# [*control_exchange*] # [*control_exchange*]
# (Optional) The default exchange under which topics are scoped. May be # (Optional) The default exchange under which topics are scoped. May be
@ -73,12 +78,12 @@
# transport://user:pass@host1:port[,hostN:portN]/virtual_host # transport://user:pass@host1:port[,hostN:portN]/virtual_host
# Defaults to $::os_service_default # Defaults to $::os_service_default
# #
# [*rpc_backend*] # [*rpc_backend*]
# The messaging driver to use, defaults to rabbit. Other drivers include # (optional) The messaging driver to use, defaults to rabbit. Other drivers include
# amqp and zmq. (string value) # amqp and zmq. (string value)
# Default to $::os_service_default # Default to $::os_service_default
#
# #
# [*rabbit_ha_queues*] # [*rabbit_ha_queues*]
# (Optional) Use HA queues in RabbitMQ (x-ha-policy: all). If you change this # (Optional) Use HA queues in RabbitMQ (x-ha-policy: all). If you change this
# option, you must wipe the RabbitMQ database. (boolean value) # option, you must wipe the RabbitMQ database. (boolean value)
@ -95,28 +100,28 @@
# we check the heartbeat. (integer value) # we check the heartbeat. (integer value)
# Defaults to $::os_service_default # Defaults to $::os_service_default
# #
# [*rabbit_use_ssl*] # [*rabbit_use_ssl*]
# (Optional) Connect over SSL for RabbitMQ. (boolean value) # (Optional) Connect over SSL for RabbitMQ. (boolean value)
# Defaults to $::os_service_default # Defaults to $::os_service_default
# #
# [*amqp_durable_queues*] # [*amqp_durable_queues*]
# (optional) Define queues as "durable" to rabbitmq. # (optional) Define queues as "durable" to rabbitmq.
# Defaults to $::os_service_default # Defaults to $::os_service_default
# #
# [*kombu_ssl_ca_certs*] # [*kombu_ssl_ca_certs*]
# (Optional) SSL certification authority file (valid only if SSL enabled). # (Optional) SSL certification authority file (valid only if SSL enabled).
# (string value) # (string value)
# Defaults to $::os_service_default # Defaults to $::os_service_default
# #
# [*kombu_ssl_certfile*] # [*kombu_ssl_certfile*]
# (Optional) SSL cert file (valid only if SSL enabled). (string value) # (Optional) SSL cert file (valid only if SSL enabled). (string value)
# Defaults to $::os_service_default # Defaults to $::os_service_default
# #
# [*kombu_ssl_keyfile*] # [*kombu_ssl_keyfile*]
# (Optional) SSL key file (valid only if SSL enabled). (string value) # (Optional) SSL key file (valid only if SSL enabled). (string value)
# Defaults to $::os_service_default # Defaults to $::os_service_default
# #
# [*kombu_ssl_version*] # [*kombu_ssl_version*]
# (Optional) SSL version to use (valid only if SSL enabled). ' # (Optional) SSL version to use (valid only if SSL enabled). '
# Valid values are TLSv1 and SSLv23. SSLv2, SSLv3, TLSv1_1, # Valid values are TLSv1 and SSLv23. SSLv2, SSLv3, TLSv1_1,
# and TLSv1_2 may be available on some distributions. (string value) # and TLSv1_2 may be available on some distributions. (string value)
@ -214,29 +219,29 @@
# #
# [*alarm_history_time_to_live*] # [*alarm_history_time_to_live*]
# #
# [*rabbit_host*] # [*rabbit_host*]
# (Optional) The RabbitMQ broker address where a single node is used. # (Optional) The RabbitMQ broker address where a single node is used.
# (string value) # (string value)
# Defaults to $::os_service_default # Defaults to $::os_service_default
# #
# [*rabbit_port*] # [*rabbit_port*]
# (Optional) The RabbitMQ broker port where a single node is used. # (Optional) The RabbitMQ broker port where a single node is used.
# (port value) # (port value)
# Defaults to $::os_service_default # Defaults to $::os_service_default
# #
# [*rabbit_hosts*] # [*rabbit_hosts*]
# (Optional) RabbitMQ HA cluster host:port pairs. (array value) # (Optional) RabbitMQ HA cluster host:port pairs. (array value)
# Defaults to $::os_service_default # Defaults to $::os_service_default
# #
# [*rabbit_userid*] # [*rabbit_userid*]
# (Optional) The RabbitMQ userid. (string value) # (Optional) The RabbitMQ userid. (string value)
# Defaults to $::os_service_default # Defaults to $::os_service_default
# #
# [*rabbit_password*] # [*rabbit_password*]
# (Optional) The RabbitMQ password. (string value) # (Optional) The RabbitMQ password. (string value)
# Defaults to $::os_service_default # Defaults to $::os_service_default
# #
# [*rabbit_virtual_host*] # [*rabbit_virtual_host*]
# (Optional) The RabbitMQ virtual host. (string value) # (Optional) The RabbitMQ virtual host. (string value)
# Defaults to $::os_service_default # Defaults to $::os_service_default
# #
@ -246,6 +251,7 @@ class ceilometer(
$metering_time_to_live = '-1', $metering_time_to_live = '-1',
$telemetry_secret = false, $telemetry_secret = false,
$notification_topics = ['notifications'], $notification_topics = ['notifications'],
$notification_driver = $::os_service_default,
$package_ensure = 'present', $package_ensure = 'present',
$debug = undef, $debug = undef,
$log_dir = undef, $log_dir = undef,
@ -407,6 +413,7 @@ deprecated. Please use ceilometer::default_transport_url instead.")
oslo::messaging::notifications { 'ceilometer_config': oslo::messaging::notifications { 'ceilometer_config':
transport_url => $notification_transport_url, transport_url => $notification_transport_url,
topics => $notification_topics, topics => $notification_topics,
driver => $notification_driver,
} }
oslo::messaging::default { 'ceilometer_config': oslo::messaging::default { 'ceilometer_config':

View File

@ -0,0 +1,4 @@
---
features:
- Add new parameter "notification_driver", driver or drivers to
handle sending notifications. Value can be a string or a list.

View File

@ -130,6 +130,7 @@ describe 'ceilometer' do
it 'configures notifications' do 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/topics').with_value('notifications')
is_expected.to contain_ceilometer_config('oslo_messaging_notifications/driver').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ceilometer_config('oslo_messaging_notifications/transport_url').with_value('<SERVICE DEFAULT>') is_expected.to contain_ceilometer_config('oslo_messaging_notifications/transport_url').with_value('<SERVICE DEFAULT>')
end end
@ -158,12 +159,14 @@ describe 'ceilometer' do
before { before {
params.merge!( params.merge!(
:notification_topics => ['notifications', 'custom'], :notification_topics => ['notifications', 'custom'],
:notification_driver => 'messagingv1',
:notification_transport_url => 'rabbit://rabbit_user:password@localhost:5673', :notification_transport_url => 'rabbit://rabbit_user:password@localhost:5673',
) )
} }
it 'configures notifications' 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/topics').with_value('notifications,custom')
is_expected.to contain_ceilometer_config('oslo_messaging_notifications/driver').with_value('messagingv1')
is_expected.to contain_ceilometer_config('oslo_messaging_notifications/transport_url').with_value('rabbit://rabbit_user:password@localhost:5673') is_expected.to contain_ceilometer_config('oslo_messaging_notifications/transport_url').with_value('rabbit://rabbit_user:password@localhost:5673')
end end
end end