Merge "Allow setting batch size for expirer"
This commit is contained in:
commit
e9c2f20e88
|
@ -34,15 +34,20 @@
|
|||
# all cron jobs at the same time on all hosts this job is configured.
|
||||
# Defaults to 0.
|
||||
#
|
||||
# [*alarm_histories_delete_batch_size*]
|
||||
# (optional) Limit number of deleted alarm histories in single purge run
|
||||
# Defaults to $::os_service_default.
|
||||
#
|
||||
class aodh::expirer (
|
||||
$ensure = 'present',
|
||||
$package_ensure = 'present',
|
||||
$minute = 1,
|
||||
$hour = 0,
|
||||
$monthday = '*',
|
||||
$month = '*',
|
||||
$weekday = '*',
|
||||
$maxdelay = 0,
|
||||
$ensure = 'present',
|
||||
$package_ensure = 'present',
|
||||
$minute = 1,
|
||||
$hour = 0,
|
||||
$monthday = '*',
|
||||
$month = '*',
|
||||
$weekday = '*',
|
||||
$maxdelay = 0,
|
||||
$alarm_histories_delete_batch_size = $::os_service_default,
|
||||
) {
|
||||
|
||||
include aodh::params
|
||||
|
@ -59,6 +64,10 @@ class aodh::expirer (
|
|||
$sleep = "sleep `expr \${RANDOM} \\% ${maxdelay}`; "
|
||||
}
|
||||
|
||||
aodh_config { 'database/alarm_histories_delete_batch_size':
|
||||
value => $alarm_histories_delete_batch_size
|
||||
}
|
||||
|
||||
cron { 'aodh-expirer':
|
||||
ensure => $ensure,
|
||||
command => "${sleep}${aodh::params::expirer_command}",
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
features:
|
||||
- |
|
||||
Added alarm_histories_delete_batch_size parameter to the expire class to
|
||||
enable configuration of the parameter with the same name. It allows
|
||||
limiting number of alarm histories purged by a single purge run.
|
|
@ -9,6 +9,7 @@ describe 'aodh::expirer' do
|
|||
context 'with default' do
|
||||
it { is_expected.to contain_class('aodh::deps') }
|
||||
it { is_expected.to contain_class('aodh::params') }
|
||||
it { is_expected.to contain_aodh_config('database/alarm_histories_delete_batch_size').with_value('<SERVICE DEFAULT>') }
|
||||
|
||||
it 'installs aodh-expirer package' do
|
||||
is_expected.to contain_package(platform_params[:expirer_package_name]).with(
|
||||
|
@ -34,13 +35,15 @@ describe 'aodh::expirer' do
|
|||
context 'with overridden parameters' do
|
||||
before do
|
||||
params.merge!(
|
||||
:ensure => 'absent',
|
||||
:maxdelay => 300
|
||||
:ensure => 'absent',
|
||||
:maxdelay => 300,
|
||||
:alarm_histories_delete_batch_size => 500
|
||||
)
|
||||
end
|
||||
|
||||
it { is_expected.to contain_class('aodh::deps') }
|
||||
it { is_expected.to contain_class('aodh::params') }
|
||||
it { is_expected.to contain_aodh_config('database/alarm_histories_delete_batch_size').with_value(500) }
|
||||
|
||||
it 'installs aodh-expirer package' do
|
||||
is_expected.to contain_package(platform_params[:expirer_package_name]).with(
|
||||
|
|
Loading…
Reference in New Issue