Improve notifications parameters
Reasons: - The monitoring_notifications parameter is old and only valid for stable/essex. - We need to change the driver and topics notification - We need to notify on VM or/and task state changes Changes: - Add notification_driver option - Add notification_topics option - Add notify_api_faults option - Add notify_on_state_change option Change-Id: I9d1c5c57a4a5f805e174390d53a0f54319b16c79
This commit is contained in:
parent
05ddd0ae03
commit
3ca8d4d8c8
|
@ -194,6 +194,27 @@
|
||||||
# are 0.9 and 2.2
|
# are 0.9 and 2.2
|
||||||
# Defaults to '0.9'
|
# Defaults to '0.9'
|
||||||
#
|
#
|
||||||
|
# [*notification_driver*]
|
||||||
|
# (optional) Driver or drivers to handle sending notifications.
|
||||||
|
# Value can be a string or a list.
|
||||||
|
# Defaults to []
|
||||||
|
#
|
||||||
|
# [*notification_topics*]
|
||||||
|
# (optional) AMQP topic used for OpenStack notifications
|
||||||
|
# Defaults to 'notifications'
|
||||||
|
#
|
||||||
|
# [*notify_api_faults*]
|
||||||
|
# (optional) If set, send api.fault notifications on caught
|
||||||
|
# exceptions in the API service
|
||||||
|
# Defaults to false
|
||||||
|
#
|
||||||
|
# [*notify_on_state_change*]
|
||||||
|
# (optional) If set, send compute.instance.update notifications
|
||||||
|
# on instance state changes. Valid values are None for no notifications,
|
||||||
|
# "vm_state" for notifications on VM state changes, or "vm_and_task_state"
|
||||||
|
# for notifications on VM and task state changes.
|
||||||
|
# Defaults to undef
|
||||||
|
#
|
||||||
class nova(
|
class nova(
|
||||||
$ensure_package = 'present',
|
$ensure_package = 'present',
|
||||||
$database_connection = false,
|
$database_connection = false,
|
||||||
|
@ -243,6 +264,10 @@ class nova(
|
||||||
$log_facility = 'LOG_USER',
|
$log_facility = 'LOG_USER',
|
||||||
$install_utilities = true,
|
$install_utilities = true,
|
||||||
$mysql_module = '0.9',
|
$mysql_module = '0.9',
|
||||||
|
$notification_driver = [],
|
||||||
|
$notification_topics = 'notifications',
|
||||||
|
$notify_api_faults = false,
|
||||||
|
$notify_on_state_change = undef,
|
||||||
# DEPRECATED PARAMETERS
|
# DEPRECATED PARAMETERS
|
||||||
# this is how to query all resources from our clutser
|
# this is how to query all resources from our clutser
|
||||||
$nova_cluster_id = undef,
|
$nova_cluster_id = undef,
|
||||||
|
@ -477,10 +502,23 @@ class nova(
|
||||||
nova_config { 'DEFAULT/log_dir': ensure => absent;}
|
nova_config { 'DEFAULT/log_dir': ensure => absent;}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if $monitoring_notifications {
|
||||||
|
warning('The monitoring_notifications parameter is deprecated, use notification_driver instead.')
|
||||||
|
$notification_driver_real = 'nova.openstack.common.notifier.rpc_notifier'
|
||||||
|
} else {
|
||||||
|
$notification_driver_real = is_string($notification_driver) ? {
|
||||||
|
true => $notification_driver,
|
||||||
|
default => join($notification_driver, ',')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
nova_config {
|
nova_config {
|
||||||
'DEFAULT/verbose': value => $verbose;
|
'DEFAULT/verbose': value => $verbose;
|
||||||
'DEFAULT/debug': value => $debug;
|
'DEFAULT/debug': value => $debug;
|
||||||
'DEFAULT/rpc_backend': value => $rpc_backend;
|
'DEFAULT/rpc_backend': value => $rpc_backend;
|
||||||
|
'DEFAULT/notification_driver': value => $notification_driver_real;
|
||||||
|
'DEFAULT/notification_topics': value => $notification_topics;
|
||||||
|
'DEFAULT/notify_api_faults': value => $notify_api_faults;
|
||||||
# Following may need to be broken out to different nova services
|
# Following may need to be broken out to different nova services
|
||||||
'DEFAULT/state_path': value => $state_path;
|
'DEFAULT/state_path': value => $state_path;
|
||||||
'DEFAULT/lock_path': value => $lock_path;
|
'DEFAULT/lock_path': value => $lock_path;
|
||||||
|
@ -488,10 +526,12 @@ class nova(
|
||||||
'DEFAULT/rootwrap_config': value => $rootwrap_config;
|
'DEFAULT/rootwrap_config': value => $rootwrap_config;
|
||||||
}
|
}
|
||||||
|
|
||||||
if $monitoring_notifications {
|
if $notify_on_state_change and $notify_on_state_change in ['vm_state', 'vm_and_task_state'] {
|
||||||
nova_config {
|
nova_config {
|
||||||
'DEFAULT/notification_driver': value => 'nova.openstack.common.notifier.rpc_notifier'
|
'DEFAULT/notify_on_state_change': value => $notify_on_state_change;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
nova_config { 'DEFAULT/notify_on_state_change': ensure => absent; }
|
||||||
}
|
}
|
||||||
|
|
||||||
# Syslog configuration
|
# Syslog configuration
|
||||||
|
|
|
@ -95,7 +95,6 @@ describe 'nova' do
|
||||||
should contain_nova_config('DEFAULT/lock_path').with_value(platform_params[:lock_path])
|
should contain_nova_config('DEFAULT/lock_path').with_value(platform_params[:lock_path])
|
||||||
should contain_nova_config('DEFAULT/service_down_time').with_value('60')
|
should contain_nova_config('DEFAULT/service_down_time').with_value('60')
|
||||||
should contain_nova_config('DEFAULT/rootwrap_config').with_value('/etc/nova/rootwrap.conf')
|
should contain_nova_config('DEFAULT/rootwrap_config').with_value('/etc/nova/rootwrap.conf')
|
||||||
should_not contain_nova_config('DEFAULT/notification_driver')
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'installs utilities' do
|
it 'installs utilities' do
|
||||||
|
@ -125,9 +124,11 @@ describe 'nova' do
|
||||||
:service_down_time => '120',
|
:service_down_time => '120',
|
||||||
:auth_strategy => 'foo',
|
:auth_strategy => 'foo',
|
||||||
:ensure_package => '2012.1.1-15.el6',
|
:ensure_package => '2012.1.1-15.el6',
|
||||||
:monitoring_notifications => true,
|
|
||||||
:memcached_servers => ['memcached01:11211', 'memcached02:11211'],
|
:memcached_servers => ['memcached01:11211', 'memcached02:11211'],
|
||||||
:install_utilities => false,
|
:install_utilities => false,
|
||||||
|
:notification_driver => 'ceilometer.compute.nova_notifier',
|
||||||
|
:notification_topics => 'openstack',
|
||||||
|
:notify_api_faults => true,
|
||||||
:nova_user_id => '499',
|
:nova_user_id => '499',
|
||||||
:nova_group_id => '499' }
|
:nova_group_id => '499' }
|
||||||
end
|
end
|
||||||
|
@ -191,7 +192,17 @@ describe 'nova' do
|
||||||
should contain_nova_config('DEFAULT/state_path').with_value('/var/lib/nova2')
|
should contain_nova_config('DEFAULT/state_path').with_value('/var/lib/nova2')
|
||||||
should contain_nova_config('DEFAULT/lock_path').with_value('/var/locky/path')
|
should contain_nova_config('DEFAULT/lock_path').with_value('/var/locky/path')
|
||||||
should contain_nova_config('DEFAULT/service_down_time').with_value('120')
|
should contain_nova_config('DEFAULT/service_down_time').with_value('120')
|
||||||
should contain_nova_config('DEFAULT/notification_driver').with_value('nova.openstack.common.notifier.rpc_notifier')
|
should contain_nova_config('DEFAULT/notification_driver').with_value('ceilometer.compute.nova_notifier')
|
||||||
|
should contain_nova_config('DEFAULT/notification_topics').with_value('openstack')
|
||||||
|
should contain_nova_config('DEFAULT/notify_api_faults').with_value(true)
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'with multiple notification_driver' do
|
||||||
|
before { params.merge!( :notification_driver => ['ceilometer.compute.nova_notifier', 'nova.openstack.common.notifier.rpc_notifier']) }
|
||||||
|
|
||||||
|
it { should contain_nova_config('DEFAULT/notification_driver').with_value(
|
||||||
|
'ceilometer.compute.nova_notifier,nova.openstack.common.notifier.rpc_notifier'
|
||||||
|
) }
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'does not install utilities' do
|
it 'does not install utilities' do
|
||||||
|
@ -205,6 +216,26 @@ describe 'nova' do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'with wrong notify_on_state_change parameter' do
|
||||||
|
let :params do
|
||||||
|
{ :notify_on_state_change => 'vm_status' }
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'configures database' do
|
||||||
|
should contain_nova_config('DEFAULT/notify_on_state_change').with_ensure('absent')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'with notify_on_state_change parameter' do
|
||||||
|
let :params do
|
||||||
|
{ :notify_on_state_change => 'vm_state' }
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'configures database' do
|
||||||
|
should contain_nova_config('DEFAULT/notify_on_state_change').with_value('vm_state')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
context 'with deprecated sql parameters' do
|
context 'with deprecated sql parameters' do
|
||||||
let :params do
|
let :params do
|
||||||
{ :sql_connection => 'mysql://user:pass@db/db',
|
{ :sql_connection => 'mysql://user:pass@db/db',
|
||||||
|
|
Loading…
Reference in New Issue