From 24e5df42ebbcf95262e5ed8ce9474731c7349925 Mon Sep 17 00:00:00 2001 From: Sergey Kolekonov Date: Wed, 4 May 2016 17:59:18 +0300 Subject: [PATCH] Add oslo.messaging notitication related options Add an ability to configure olso.messaging notification related options: driver, transport_url and topics Change-Id: If8bf8c2d183d6a849b92f0d277866769e5beafc3 --- manifests/init.pp | 23 +++++++++++++++++++ ...dd_notification_opts-331f756075eaa50a.yaml | 3 +++ spec/classes/neutron_init_spec.rb | 21 +++++++++++++++++ 3 files changed, 47 insertions(+) create mode 100644 releasenotes/notes/add_notification_opts-331f756075eaa50a.yaml diff --git a/manifests/init.pp b/manifests/init.pp index 20ac77bca..9837a7636 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -254,6 +254,20 @@ # in the neutron config. # Defaults to false. # +# [*notification_driver*] +# (optional) Driver or drivers to handle sending notifications. +# Value can be a string or a list. +# Defaults to $::os_service_default. +# +# [*notification_topics*] +# (optional) AMQP topic used for OpenStack notifications +# Defaults to ::os_service_default +# +# [*notification_transport_url*] +# (optional) A URL representing the messaging driver to use for +# notifications. +# Defaults to $::os_service_default. +# # DEPRECATED PARAMETERS # # [*network_device_mtu*] @@ -315,6 +329,9 @@ class neutron ( $state_path = $::os_service_default, $lock_path = '$state_path/lock', $purge_config = false, + $notification_driver = $::os_service_default, + $notification_topics = $::os_service_default, + $notification_transport_url = $::os_service_default, # DEPRECATED PARAMETERS $network_device_mtu = undef, ) { @@ -405,6 +422,12 @@ class neutron ( oslo::concurrency { 'neutron_config': lock_path => $lock_path } + oslo::messaging::notifications { 'neutron_config': + driver => $notification_driver, + topics => $notification_topics, + transport_url => $notification_transport_url, + } + if ! is_service_default ($service_plugins) and ($service_plugins) { if is_array($service_plugins) { neutron_config { 'DEFAULT/service_plugins': value => join($service_plugins, ',') } diff --git a/releasenotes/notes/add_notification_opts-331f756075eaa50a.yaml b/releasenotes/notes/add_notification_opts-331f756075eaa50a.yaml new file mode 100644 index 000000000..07672ddce --- /dev/null +++ b/releasenotes/notes/add_notification_opts-331f756075eaa50a.yaml @@ -0,0 +1,3 @@ +--- +features: + - Add oslo.messaging notitications related options diff --git a/spec/classes/neutron_init_spec.rb b/spec/classes/neutron_init_spec.rb index c6ff8e629..9cc64b924 100644 --- a/spec/classes/neutron_init_spec.rb +++ b/spec/classes/neutron_init_spec.rb @@ -44,6 +44,13 @@ describe 'neutron' do it_configures 'rabbit_ha_queues set to false' end + context 'with non-default notification options' do + before { params.merge!( :notification_driver => 'messagingv2', + :notification_topics => 'notifications', + :notification_transport_url => 'rabbit://me:passwd@host:5672/virtual_host' ) } + it_configures 'notification_driver and notification_topics' + end + it 'configures logging' do is_expected.to contain_neutron_config('DEFAULT/log_file').with_value('') is_expected.to contain_neutron_config('DEFAULT/log_dir').with_value(params[:log_dir]) @@ -99,6 +106,12 @@ describe 'neutron' do }) end + it 'configures messaging notifications' do + is_expected.to contain_neutron_config('oslo_messaging_notifications/driver').with_value('') + is_expected.to contain_neutron_config('oslo_messaging_notifications/topics').with_value('') + is_expected.to contain_neutron_config('oslo_messaging_notifications/transport_url').with_value('') + end + it 'configures credentials for rabbit' do is_expected.to contain_neutron_config('oslo_messaging_rabbit/rabbit_userid').with_value( '' ) is_expected.to contain_neutron_config('oslo_messaging_rabbit/rabbit_password').with_value( params[:rabbit_password] ) @@ -174,6 +187,14 @@ describe 'neutron' do end end + shared_examples_for 'notification_driver and notification_topics' do + it 'in neutron.conf' do + is_expected.to contain_neutron_config('oslo_messaging_notifications/driver').with_value( params[:notification_driver] ) + is_expected.to contain_neutron_config('oslo_messaging_notifications/topics').with_value( params[:notification_topics] ) + is_expected.to contain_neutron_config('oslo_messaging_notifications/transport_url').with_value( params[:notification_transport_url] ) + end + end + shared_examples_for 'with SSL socket options set' do before do params.merge!(