Allow setting batch size for expirer
This change introduces a new option to set batch size for expirer, which allows limiting number of alamr histories purged in a single run. Depends-on: https://review.opendev.org/755983 Change-Id: Ie37a3c377c455dbafa9cc57ddecb8b8963fc9a82
This commit is contained in:
parent
5f1e9e7c5c
commit
216fddb348
@ -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}",
|
||||
|
6
releasenotes/notes/batchsize-6f6d2382eeb7e025.yaml
Normal file
6
releasenotes/notes/batchsize-6f6d2382eeb7e025.yaml
Normal file
@ -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…
x
Reference in New Issue
Block a user