Add support for db_max_retries param

The db_max_retries parameter regulates the number of reconnection
attempts performed after an error raised rather than at startup.

Change-Id: Ie4f94a07c6e6e9fdddd8c048447e493abb3ebd48
Closes-Bug: 1579718
This commit is contained in:
nanhai.liao 2016-05-10 08:58:56 +08:00
parent 099774011c
commit c21602d8f4
2 changed files with 10 additions and 0 deletions

View File

@ -33,6 +33,11 @@
# If set, use this value for max_overflow with sqlalchemy.
# (Optional) Defaults to $::os_service_default.
#
# [*database_db_max_retries*]
# (Optional) Maximum retries in case of connection error or deadlock error
# before error is raised. Set to -1 to specify an infinite retry count.
# Defaults to $::os_service_default
#
# [*sync_db*]
# (Optional) Run db sync on nodes after connection setting has been set.
# Defaults to true
@ -45,6 +50,7 @@ class heat::db (
$database_max_retries = $::os_service_default,
$database_retry_interval = $::os_service_default,
$database_max_overflow = $::os_service_default,
$database_db_max_retries = $::os_service_default,
$sync_db = true,
) {
@ -72,6 +78,7 @@ class heat::db (
max_retries => $database_max_retries_real,
retry_interval => $database_retry_interval_real,
max_overflow => $database_max_overflow_real,
db_max_retries => $database_db_max_retries,
}
if $sync_db_real {

View File

@ -13,6 +13,7 @@ describe 'heat::db' do
it { is_expected.to contain_heat_config('database/max_pool_size').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_heat_config('database/max_retries').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_heat_config('database/retry_interval').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_heat_config('database/db_max_retries').with_value('<SERVICE DEFAULT>') }
end
@ -24,6 +25,7 @@ describe 'heat::db' do
:database_max_pool_size => '12',
:database_max_retries => '11',
:database_retry_interval => '11',
:database_db_max_retries => '-1',
:sync_db => false }
end
@ -34,6 +36,7 @@ describe 'heat::db' do
it { is_expected.to contain_heat_config('database/max_pool_size').with_value('12') }
it { is_expected.to contain_heat_config('database/max_retries').with_value('11') }
it { is_expected.to contain_heat_config('database/retry_interval').with_value('11') }
it { is_expected.to contain_heat_config('database/db_max_retries').with_value('-1') }
end