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:
@@ -34,15 +34,20 @@
|
|||||||
# all cron jobs at the same time on all hosts this job is configured.
|
# all cron jobs at the same time on all hosts this job is configured.
|
||||||
# Defaults to 0.
|
# 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 (
|
class aodh::expirer (
|
||||||
$ensure = 'present',
|
$ensure = 'present',
|
||||||
$package_ensure = 'present',
|
$package_ensure = 'present',
|
||||||
$minute = 1,
|
$minute = 1,
|
||||||
$hour = 0,
|
$hour = 0,
|
||||||
$monthday = '*',
|
$monthday = '*',
|
||||||
$month = '*',
|
$month = '*',
|
||||||
$weekday = '*',
|
$weekday = '*',
|
||||||
$maxdelay = 0,
|
$maxdelay = 0,
|
||||||
|
$alarm_histories_delete_batch_size = $::os_service_default,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
include aodh::params
|
include aodh::params
|
||||||
@@ -59,6 +64,10 @@ class aodh::expirer (
|
|||||||
$sleep = "sleep `expr \${RANDOM} \\% ${maxdelay}`; "
|
$sleep = "sleep `expr \${RANDOM} \\% ${maxdelay}`; "
|
||||||
}
|
}
|
||||||
|
|
||||||
|
aodh_config { 'database/alarm_histories_delete_batch_size':
|
||||||
|
value => $alarm_histories_delete_batch_size
|
||||||
|
}
|
||||||
|
|
||||||
cron { 'aodh-expirer':
|
cron { 'aodh-expirer':
|
||||||
ensure => $ensure,
|
ensure => $ensure,
|
||||||
command => "${sleep}${aodh::params::expirer_command}",
|
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
|
context 'with default' do
|
||||||
it { is_expected.to contain_class('aodh::deps') }
|
it { is_expected.to contain_class('aodh::deps') }
|
||||||
it { is_expected.to contain_class('aodh::params') }
|
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
|
it 'installs aodh-expirer package' do
|
||||||
is_expected.to contain_package(platform_params[:expirer_package_name]).with(
|
is_expected.to contain_package(platform_params[:expirer_package_name]).with(
|
||||||
@@ -34,13 +35,15 @@ describe 'aodh::expirer' do
|
|||||||
context 'with overridden parameters' do
|
context 'with overridden parameters' do
|
||||||
before do
|
before do
|
||||||
params.merge!(
|
params.merge!(
|
||||||
:ensure => 'absent',
|
:ensure => 'absent',
|
||||||
:maxdelay => 300
|
:maxdelay => 300,
|
||||||
|
:alarm_histories_delete_batch_size => 500
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
it { is_expected.to contain_class('aodh::deps') }
|
it { is_expected.to contain_class('aodh::deps') }
|
||||||
it { is_expected.to contain_class('aodh::params') }
|
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
|
it 'installs aodh-expirer package' do
|
||||||
is_expected.to contain_package(platform_params[:expirer_package_name]).with(
|
is_expected.to contain_package(platform_params[:expirer_package_name]).with(
|
||||||
|
Reference in New Issue
Block a user