Allow db sync timeouts to be configurable

As Openstack projects continue to have longer database migration
chains, the Puppet default timeout of 300 seconds for an execution
is becoming too short a duration on some hardware, leading to timeouts.
As projects continue to add more migration scripts without pruning
the base, timeouts will continue to become more frequent unless
this time can be expanded.

Change-Id: I7c461005b2686e50dc8affd9bf2ecb0115654bec
Closes-Bug: #1904962
This commit is contained in:
ZhongShengping 2020-11-23 09:27:52 +08:00
parent 8d64eeea0b
commit 60eb6d732d
5 changed files with 26 additions and 4 deletions

View File

@ -8,8 +8,13 @@
# to the ironic-dbsync command.
# Defaults to undef
#
# [*db_sync_timeout*]
# (Optional) Timeout for the execution of the db_sync
# Defaults to 300
#
class ironic::db::sync(
$extra_params = undef,
$extra_params = undef,
$db_sync_timeout = 300,
) {
include ironic::deps
@ -33,6 +38,7 @@ class ironic::db::sync(
refreshonly => true,
try_sleep => 5,
tries => 10,
timeout => $db_sync_timeout,
logoutput => on_failure,
subscribe => [
Anchor['ironic::install::end'],

View File

@ -1,7 +1,15 @@
#
# Class to execute ironic-inspector dbsync
#
class ironic::inspector::db::sync {
# == Parameters
#
# [*db_sync_timeout*]
# (Optional) Timeout for the execution of the db_sync
# Defaults to 300
#
class ironic::inspector::db::sync(
$db_sync_timeout = 300,
) {
include ironic::deps
include ironic::params
@ -11,6 +19,7 @@ class ironic::inspector::db::sync {
path => '/usr/bin',
user => 'ironic-inspector',
refreshonly => true,
timeout => $db_sync_timeout,
logoutput => on_failure,
subscribe => [
Anchor['ironic-inspector::install::end'],

View File

@ -0,0 +1,3 @@
---
features:
- Adds db_sync_timeout parameter to db sync.

View File

@ -14,6 +14,7 @@ describe 'ironic::db::sync' do
:refreshonly => 'true',
:try_sleep => 5,
:tries => 10,
:timeout => 300,
:logoutput => 'on_failure',
:subscribe => ['Anchor[ironic::install::end]',
'Anchor[ironic::config::end]',
@ -29,10 +30,11 @@ describe 'ironic::db::sync' do
)
end
describe "overriding extra_params" do
describe "overriding params" do
let :params do
{
:extra_params => '--config-file /etc/ironic/ironic_01.conf',
:extra_params => '--config-file /etc/ironic/ironic_01.conf',
:db_sync_timeout => 750,
}
end
it { is_expected.to contain_exec('ironic-dbsync').with(
@ -42,6 +44,7 @@ describe 'ironic::db::sync' do
:refreshonly => true,
:try_sleep => 5,
:tries => 10,
:timeout => 750,
:logoutput => 'on_failure',
:subscribe => ['Anchor[ironic::install::end]',
'Anchor[ironic::config::end]',

View File

@ -11,6 +11,7 @@ describe 'ironic::inspector::db::sync' do
:command => 'ironic-inspector-dbsync --config-file /etc/ironic-inspector/inspector.conf upgrade',
:path => '/usr/bin',
:user => 'ironic-inspector',
:timeout => 300,
:refreshonly => 'true',
:logoutput => 'on_failure',
:tag => 'openstack-db',