Files
puppet-ironic/manifests/db/sync.pp
ZhongShengping 60eb6d732d 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
2020-11-25 09:19:08 +08:00

53 lines
1.4 KiB
Puppet

#
# Class to execute ironic dbsync
#
# == Parameters
#
# [*extra_params*]
# (Optional) String of extra command line parameters to append
# 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,
$db_sync_timeout = 300,
) {
include ironic::deps
include ironic::params
# NOTE(dtantsur): previous ironic-dbsync was run as root. it will fail to run
# as "ironic" user, if there is an old log file owned by root. Let's fix it.
# To be removed in Rocky.
file { '/var/log/ironic/ironic-dbsync.log':
ensure => 'present',
owner => 'ironic',
group => 'ironic',
# /var/log/ironic comes from ironic-common
require => Anchor['ironic::install::end']
}
exec { 'ironic-dbsync':
command => "${::ironic::params::dbsync_command} ${extra_params}",
path => '/usr/bin',
user => 'ironic',
refreshonly => true,
try_sleep => 5,
tries => 10,
timeout => $db_sync_timeout,
logoutput => on_failure,
subscribe => [
Anchor['ironic::install::end'],
Anchor['ironic::config::end'],
Anchor['ironic::dbsync::begin']
],
notify => Anchor['ironic::dbsync::end'],
require => File['/var/log/ironic/ironic-dbsync.log'],
tag => 'openstack-db',
}
}