diff --git a/README.md b/README.md index ecd48e37..504eb23b 100644 --- a/README.md +++ b/README.md @@ -53,8 +53,6 @@ class { '::ceilometer': class { '::ceilometer::client': } class { '::ceilometer::collector': } class { '::ceilometer::expirer': } -class { '::ceilometer::alarm::evaluator': } -class { '::ceilometer::alarm::notifier': } class { '::ceilometer::agent::central': } class { '::ceilometer::agent::notification': } class { '::ceilometer::db': } diff --git a/examples/site.pp b/examples/site.pp index d9b51586..3d3616e7 100644 --- a/examples/site.pp +++ b/examples/site.pp @@ -74,14 +74,6 @@ node default { # class { 'ceilometer::agent::central': # } - # Install alarm notifier - class { '::ceilometer::alarm::notifier': - } - - # Install alarm evaluator - class { '::ceilometer::alarm::evaluator': - } - # Purge old meters class { '::ceilometer::expirer': } diff --git a/manifests/alarm/evaluator.pp b/manifests/alarm/evaluator.pp index 62779f8c..1c1dcd71 100644 --- a/manifests/alarm/evaluator.pp +++ b/manifests/alarm/evaluator.pp @@ -1,4 +1,4 @@ -# == Class: ceilometer::alarm::evaluator +# == Deprecated class: ceilometer::alarm::evaluator # # Installs the ceilometer alarm evaluator service # @@ -6,82 +6,42 @@ # # [*enabled*] # (Optional) Should the service be enabled. -# Defaults to true. +# Defaults to undef. # # [*manage_service*] # (Optional) Whether the service should be managed by Puppet. -# Defaults to true. +# Defaults to undef. # # [*evaluation_interval*] # (Optional) Define the time interval for the alarm evaluator -# Defaults to 60. +# Defaults to undef. # # [*evaluation_service*] # (Optional) Define which service use for the evaluator -# Defaults to 'ceilometer.alarm.service.SingletonAlarmService'. +# Defaults to undef. # # [*partition_rpc_topic*] # (Optional) Define which topic the alarm evaluator should access -# Defaults to 'alarm_partition_coordination'. +# Defaults to undef. # # [*record_history*] # (Optional) Record alarm change events -# Defaults to true. +# Defaults to undef. # # [*coordination_url*] # (Optional) The url to use for distributed group membership coordination. # Defaults to undef. # class ceilometer::alarm::evaluator ( - $manage_service = true, - $enabled = true, - $evaluation_interval = 60, - $evaluation_service = 'ceilometer.alarm.service.SingletonAlarmService', - $partition_rpc_topic = 'alarm_partition_coordination', - $record_history = true, + $manage_service = undef, + $enabled = undef, + $evaluation_interval = undef, + $evaluation_service = undef, + $partition_rpc_topic = undef, + $record_history = undef, $coordination_url = undef, ) { - include ::ceilometer::params + warning('Class is deprecated and will be removed. Use Aodh module to deploy Alarm Evaluator service') - # Cast $evaluation_interval to a string - validate_re("${evaluation_interval}",'^(\d+)$') # lint:ignore:only_variable_string - - Ceilometer_config<||> ~> Service['ceilometer-alarm-evaluator'] - - Package[$::ceilometer::params::alarm_package_name] -> Service['ceilometer-alarm-evaluator'] - Package[$::ceilometer::params::alarm_package_name] -> Package<| title == 'ceilometer-alarm' |> - ensure_packages($::ceilometer::params::alarm_package_name, - { tag => 'openstack' } - ) - - if $manage_service { - if $enabled { - $service_ensure = 'running' - } else { - $service_ensure = 'stopped' - } - } - - Package['ceilometer-common'] -> Service['ceilometer-alarm-evaluator'] - - service { 'ceilometer-alarm-evaluator': - ensure => $service_ensure, - name => $::ceilometer::params::alarm_evaluator_service_name, - enable => $enabled, - hasstatus => true, - hasrestart => true - } - - ceilometer_config { - 'alarm/evaluation_interval' : value => $evaluation_interval; - 'alarm/evaluation_service' : value => $evaluation_service; - 'alarm/partition_rpc_topic' : value => $partition_rpc_topic; - 'alarm/record_history' : value => $record_history; - } - - if $coordination_url { - ensure_resource('ceilometer_config', 'coordination/backend_url', - {'value' => $coordination_url}) - } } diff --git a/manifests/alarm/notifier.pp b/manifests/alarm/notifier.pp index 98b2c353..c90f6d4a 100644 --- a/manifests/alarm/notifier.pp +++ b/manifests/alarm/notifier.pp @@ -1,4 +1,4 @@ -# == Class: ceilometer::alarm::notifier +# == Deprecated class: ceilometer::alarm::notifier # # Installs the ceilometer alarm notifier service # @@ -6,11 +6,11 @@ # # [*enabled*] # (Optional) Should the service be enabled. -# Defaults to true. +# Defaults to undef. # # [*manage_service*] # (Optional) Whether the service should be managed by Puppet. -# Defaults to true. +# Defaults to undef. # # [*notifier_rpc_topic*] # (Optional) Define on which topic the notifier will have access. @@ -26,62 +26,17 @@ # # [*rest_notifier_ssl_verify*] # (optional) Should the ssl verify parameter be enabled. -# Defaults to true. +# Defaults to undef. # class ceilometer::alarm::notifier ( - $manage_service = true, - $enabled = true, + $manage_service = undef, + $enabled = undef, $notifier_rpc_topic = undef, $rest_notifier_certificate_key = undef, $rest_notifier_certificate_file = undef, - $rest_notifier_ssl_verify = true, + $rest_notifier_ssl_verify = undef, ) { - include ::ceilometer::params - - validate_bool($rest_notifier_ssl_verify) - - Ceilometer_config<||> ~> Service['ceilometer-alarm-notifier'] - - Package[$::ceilometer::params::alarm_package_name] -> Service['ceilometer-alarm-notifier'] - Package[$::ceilometer::params::alarm_package_name] -> Package<| title == 'ceilometer-alarm' |> - ensure_packages($::ceilometer::params::alarm_package_name, - { tag => 'openstack' } - ) - - if $manage_service { - if $enabled { - $service_ensure = 'running' - } else { - $service_ensure = 'stopped' - } - } - - Package['ceilometer-common'] -> Service['ceilometer-alarm-notifier'] - - service { 'ceilometer-alarm-notifier': - ensure => $service_ensure, - name => $::ceilometer::params::alarm_notifier_service_name, - enable => $enabled, - hasstatus => true, - hasrestart => true - } - - if $notifier_rpc_topic != undef { - ceilometer_config { - 'alarm/notifier_rpc_topic' : value => $notifier_rpc_topic; - } - } - if $rest_notifier_certificate_key != undef { - ceilometer_config { - 'alarm/rest_notifier_certificate_key' :value => $rest_notifier_certificate_key; - 'alarm/rest_notifier_ssl_verify' :value => $rest_notifier_ssl_verify; - } - } - if $rest_notifier_certificate_file != undef { - ceilometer_config { - 'alarm/rest_notifier_certificate_file' :value => $rest_notifier_certificate_file; - } - } + warning('Class is deprecated and will be removed. Use Aodh module to deploy Alarm Notifier service') } diff --git a/manifests/dispatcher/gnocchi.pp b/manifests/dispatcher/gnocchi.pp index 33d1ce1e..15e8d506 100644 --- a/manifests/dispatcher/gnocchi.pp +++ b/manifests/dispatcher/gnocchi.pp @@ -1,4 +1,4 @@ -# == Class: ceilometer::alarm::notifier +# == Class: ceilometer::dispatcher::gnocchi # # Configure Gnocchi dispatcher for Ceilometer # diff --git a/manifests/init.pp b/manifests/init.pp index 7d7c2993..2cee6b9a 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -19,11 +19,6 @@ # (<= 0 means forever) # Defaults to -1. # -# [*alarm_history_time_to_live*] -# (Optional) Number of seconds that alarm histories are kept in the database for -# (<= 0 means forever) -# Defaults to -1. -# # [*metering_secret*] # (Required) Secret key for signing messages. # @@ -140,6 +135,7 @@ # # === DEPRECATED PARAMETERS: # +# [*alarm_history_time_to_live*] # [*qpid_hostname*] # [*qpid_port*] # [*qpid_username*] @@ -158,7 +154,6 @@ class ceilometer( $http_timeout = '600', $event_time_to_live = '-1', $metering_time_to_live = '-1', - $alarm_history_time_to_live = '-1', $metering_secret = false, $notification_topics = ['notifications'], $package_ensure = 'present', @@ -186,6 +181,7 @@ class ceilometer( $kombu_ssl_version = 'TLSv1', $memcached_servers = undef, # DEPRECATED PARAMETERS + $alarm_history_time_to_live = undef, $qpid_hostname = undef, $qpid_port = undef, $qpid_username = undef, @@ -219,6 +215,10 @@ class ceilometer( fail('The kombu_ssl_certfile and kombu_ssl_keyfile parameters must be used together') } + if $alarm_history_time_to_live { + warning('alarm_history_time_to_live parameter is deprecated. It should be configured for Aodh.') + } + group { 'ceilometer': name => 'ceilometer', require => Package['ceilometer-common'], @@ -324,7 +324,6 @@ class ceilometer( 'DEFAULT/notification_topics' : value => join($notification_topics, ','); 'database/event_time_to_live' : value => $event_time_to_live; 'database/metering_time_to_live' : value => $metering_time_to_live; - 'database/alarm_history_time_to_live' : value => $alarm_history_time_to_live; } if $memcached_servers { diff --git a/manifests/params.pp b/manifests/params.pp index bcf95e60..749916d3 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -18,7 +18,6 @@ class ceilometer::params { $api_package_name = 'openstack-ceilometer-api' $collector_package_name = 'openstack-ceilometer-collector' $agent_notification_package_name = 'openstack-ceilometer-notification' - $alarm_package_name = ['openstack-ceilometer-alarm'] $common_package_name = 'openstack-ceilometer-common' $client_package_name = 'python-ceilometerclient' # service names @@ -27,8 +26,6 @@ class ceilometer::params { $agent_polling_service_name = 'openstack-ceilometer-polling' $api_service_name = 'openstack-ceilometer-api' $collector_service_name = 'openstack-ceilometer-collector' - $alarm_notifier_service_name = 'openstack-ceilometer-alarm-notifier' - $alarm_evaluator_service_name = 'openstack-ceilometer-alarm-evaluator' $pymongo_package_name = 'python-pymongo' $agent_notification_service_name = 'openstack-ceilometer-notification' $ceilometer_wsgi_script_path = '/var/www/cgi-bin/ceilometer' @@ -46,7 +43,6 @@ class ceilometer::params { $agent_notification_package_name = 'ceilometer-agent-notification' $common_package_name = 'ceilometer-common' $client_package_name = 'python-ceilometerclient' - $alarm_package_name = ['ceilometer-alarm-notifier','ceilometer-alarm-evaluator'] # service names $agent_central_service_name = 'ceilometer-agent-central' $agent_compute_service_name = 'ceilometer-agent-compute' @@ -54,8 +50,6 @@ class ceilometer::params { $collector_service_name = 'ceilometer-collector' $api_service_name = 'ceilometer-api' $agent_notification_service_name = 'ceilometer-agent-notification' - $alarm_notifier_service_name = 'ceilometer-alarm-notifier' - $alarm_evaluator_service_name = 'ceilometer-alarm-evaluator' # db packages $pymongo_package_name = 'python-pymongo' $sqlite_package_name = 'python-pysqlite2' diff --git a/spec/classes/ceilometer_alarm_evaluator_spec.rb b/spec/classes/ceilometer_alarm_evaluator_spec.rb deleted file mode 100644 index 09557d97..00000000 --- a/spec/classes/ceilometer_alarm_evaluator_spec.rb +++ /dev/null @@ -1,132 +0,0 @@ -require 'spec_helper' - -describe 'ceilometer::alarm::evaluator' do - - let :pre_condition do - "class { 'ceilometer': metering_secret => 's3cr3t' }" - end - - let :params do - { :evaluation_interval => 60, - :evaluation_service => 'ceilometer.alarm.service.SingletonAlarmService', - :partition_rpc_topic => 'alarm_partition_coordination', - :record_history => true, - :enabled => true, - :manage_service => true, - } - end - - shared_examples_for 'ceilometer-alarm-evaluator' do - it { is_expected.to contain_class('ceilometer::params') } - - it 'installs ceilometer-alarm package' do - is_expected.to contain_package(platform_params[:alarm_evaluator_package_name]).with_before(['Service[ceilometer-alarm-evaluator]']) - is_expected.to contain_package(platform_params[:alarm_evaluator_package_name]).with( - :ensure => 'present', - :name => platform_params[:alarm_evaluator_package_name], - :tag => 'openstack' - ) - end - - it 'ensures ceilometer-common is installed before the service' do - is_expected.to contain_package('ceilometer-common').with( - :before => /Service\[ceilometer-alarm-evaluator\]/ - ) - end - - it 'configures alarm evaluator' do - is_expected.to contain_ceilometer_config('alarm/evaluation_interval').with_value( params[:evaluation_interval] ) - is_expected.to contain_ceilometer_config('alarm/evaluation_service').with_value( params[:evaluation_service] ) - is_expected.to contain_ceilometer_config('alarm/partition_rpc_topic').with_value( params[:partition_rpc_topic] ) - is_expected.to contain_ceilometer_config('alarm/record_history').with_value( params[:record_history] ) - is_expected.to_not contain_ceilometer_config('coordination/backend_url') - end - - context 'when overriding parameters' do - before do - params.merge!(:evaluation_interval => 80, - :partition_rpc_topic => 'alarm_partition_coordination', - :record_history => false, - :evaluation_service => 'ceilometer.alarm.service.SingletonTestAlarmService', - :coordination_url => 'redis://localhost:6379') - end - it { is_expected.to contain_ceilometer_config('alarm/evaluation_interval').with_value(params[:evaluation_interval]) } - it { is_expected.to contain_ceilometer_config('alarm/evaluation_service').with_value(params[:evaluation_service]) } - it { is_expected.to contain_ceilometer_config('alarm/record_history').with_value(params[:record_history]) } - it { is_expected.to contain_ceilometer_config('alarm/partition_rpc_topic').with_value(params[:partition_rpc_topic]) } - it { is_expected.to contain_ceilometer_config('coordination/backend_url').with_value( params[:coordination_url]) } - end - - context 'when override the evaluation interval with a non numeric value' do - before do - params.merge!(:evaluation_interval => 'NaN') - end - - it { expect { is_expected.to contain_ceilometer_config('alarm/evaluation_interval') }.to\ - raise_error(Puppet::Error, /validate_re\(\): .* does not match/) } - end - - [{:enabled => true}, {:enabled => false}].each do |param_hash| - context "when service should be #{param_hash[:enabled] ? 'enabled' : 'disabled'}" do - before do - params.merge!(param_hash) - end - - it 'configures ceilometer-alarm-evaluator service' do - is_expected.to contain_service('ceilometer-alarm-evaluator').with( - :ensure => (params[:manage_service] && params[:enabled]) ? 'running' : 'stopped', - :name => platform_params[:alarm_evaluator_service_name], - :enable => params[:enabled], - :hasstatus => true, - :hasrestart => true - ) - end - end - end - - context 'with disabled service managing' do - before do - params.merge!({ - :manage_service => false, - :enabled => false }) - end - - it 'configures ceilometer-alarm-evaluator service' do - is_expected.to contain_service('ceilometer-alarm-evaluator').with( - :ensure => nil, - :name => platform_params[:alarm_evaluator_service_name], - :enable => false, - :hasstatus => true, - :hasrestart => true - ) - end - end - end - - context 'on Debian platforms' do - let :facts do - @default_facts.merge({ :osfamily => 'Debian' }) - end - - let :platform_params do - { :alarm_evaluator_package_name => 'ceilometer-alarm-evaluator', - :alarm_evaluator_service_name => 'ceilometer-alarm-evaluator' } - end - - it_configures 'ceilometer-alarm-evaluator' - end - - context 'on RedHat platforms' do - let :facts do - @default_facts.merge({ :osfamily => 'RedHat' }) - end - - let :platform_params do - { :alarm_evaluator_package_name => 'openstack-ceilometer-alarm', - :alarm_evaluator_service_name => 'openstack-ceilometer-alarm-evaluator' } - end - - it_configures 'ceilometer-alarm-evaluator' - end - -end diff --git a/spec/classes/ceilometer_alarm_notifier_spec.rb b/spec/classes/ceilometer_alarm_notifier_spec.rb deleted file mode 100644 index d0f192f7..00000000 --- a/spec/classes/ceilometer_alarm_notifier_spec.rb +++ /dev/null @@ -1,122 +0,0 @@ -require 'spec_helper' - -describe 'ceilometer::alarm::notifier' do - - let :pre_condition do - "class { 'ceilometer': metering_secret => 's3cr3t' }" - end - - let :params do - { - #:notifier_rpc_topic => 'UNSET', - #:rest_notifier_certificate_key => 'UNSET', - #:rest_notifier_certificate_file => 'UNSET', - #:rest_notifier_ssl_verify => true, - :enabled => true, - :manage_service => true, - } - end - - shared_examples_for 'ceilometer-alarm-notifier' do - it { is_expected.to contain_class('ceilometer::params') } - - it 'installs ceilometer-alarm package' do - is_expected.to contain_package(platform_params[:alarm_notifier_package_name]).with_before(['Service[ceilometer-alarm-notifier]']) - is_expected.to contain_package(platform_params[:alarm_notifier_package_name]).with( - :ensure => 'present', - :name => platform_params[:alarm_notifier_package_name], - :tag => 'openstack' - ) - end - - it 'ensures ceilometer-common is installed before the service' do - is_expected.to contain_package('ceilometer-common').with( - :before => /Service\[ceilometer-alarm-notifier\]/ - ) - end - - it 'configures alarm notifier' do - is_expected.to_not contain_ceilometer_config('alarm/notifier_rpc_topic') - is_expected.to_not contain_ceilometer_config('alarm/rest_notifier_certificate_key') - is_expected.to_not contain_ceilometer_config('alarm/rest_notifier_certificate_file') - is_expected.to_not contain_ceilometer_config('alarm/rest_notifier_ssl_verify') - end - - context 'when overriding parameters' do - before do - params.merge!(:notifier_rpc_topic => 'alarm_notifier', - :rest_notifier_certificate_key => '0xdeadbeef', - :rest_notifier_certificate_file => '/var/file', - :rest_notifier_ssl_verify => true) - end - it { is_expected.to contain_ceilometer_config('alarm/notifier_rpc_topic').with_value(params[:notifier_rpc_topic]) } - it { is_expected.to contain_ceilometer_config('alarm/rest_notifier_certificate_key').with_value(params[:rest_notifier_certificate_key]) } - it { is_expected.to contain_ceilometer_config('alarm/rest_notifier_certificate_file').with_value(params[:rest_notifier_certificate_file]) } - it { is_expected.to contain_ceilometer_config('alarm/rest_notifier_ssl_verify').with_value(params[:rest_notifier_ssl_verify]) } - end - - [{:enabled => true}, {:enabled => false}].each do |param_hash| - context "when service should be #{param_hash[:enabled] ? 'enabled' : 'disabled'}" do - before do - params.merge!(param_hash) - end - - it 'configures ceilometer-alarm-notifier service' do - is_expected.to contain_service('ceilometer-alarm-notifier').with( - :ensure => (params[:manage_service] && params[:enabled]) ? 'running' : 'stopped', - :name => platform_params[:alarm_notifier_service_name], - :enable => params[:enabled], - :hasstatus => true, - :hasrestart => true - ) - end - end - end - - context 'with disabled service managing' do - before do - params.merge!({ - :manage_service => false, - :enabled => false }) - end - - it 'configures ceilometer-alarm-notifier service' do - is_expected.to contain_service('ceilometer-alarm-notifier').with( - :ensure => nil, - :name => platform_params[:alarm_notifier_service_name], - :enable => false, - :hasstatus => true, - :hasrestart => true - ) - end - end - - end - - context 'on Debian platforms' do - let :facts do - @default_facts.merge({ :osfamily => 'Debian' }) - end - - let :platform_params do - { :alarm_notifier_package_name => 'ceilometer-alarm-notifier', - :alarm_notifier_service_name => 'ceilometer-alarm-notifier' } - end - - it_configures 'ceilometer-alarm-notifier' - end - - context 'on RedHat platforms' do - let :facts do - @default_facts.merge({ :osfamily => 'RedHat' }) - end - - let :platform_params do - { :alarm_notifier_package_name => 'openstack-ceilometer-alarm', - :alarm_notifier_service_name => 'openstack-ceilometer-alarm-notifier' } - end - - it_configures 'ceilometer-alarm-notifier' - end - -end diff --git a/spec/classes/ceilometer_init_spec.rb b/spec/classes/ceilometer_init_spec.rb index 988d1317..55f97ae4 100644 --- a/spec/classes/ceilometer_init_spec.rb +++ b/spec/classes/ceilometer_init_spec.rb @@ -7,7 +7,6 @@ describe 'ceilometer' do :http_timeout => '600', :event_time_to_live => '604800', :metering_time_to_live => '604800', - :alarm_history_time_to_live => '604800', :metering_secret => 'metering-s3cr3t', :package_ensure => 'present', :debug => 'False', @@ -29,10 +28,9 @@ describe 'ceilometer' do shared_examples_for 'ceilometer' do - it 'configures time to live for events, meters and alarm histories' do + it 'configures time to live for events and meters' do is_expected.to contain_ceilometer_config('database/event_time_to_live').with_value( params[:event_time_to_live] ) is_expected.to contain_ceilometer_config('database/metering_time_to_live').with_value( params[:metering_time_to_live] ) - is_expected.to contain_ceilometer_config('database/alarm_history_time_to_live').with_value( params[:alarm_history_time_to_live] ) end it 'configures timeout for HTTP requests' do