Add support for the oslo db_max_retries option

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

Change-Id: I27ec589bb2e43cbb5cd32e579fc25fd8239bf0f6
Closes-Bug: 1579718
This commit is contained in:
nanhai.liao 2016-05-10 08:48:43 +08:00
parent c63a585f41
commit 931b00c7a2
2 changed files with 11 additions and 1 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
#
class neutron::db (
$database_connection = 'sqlite:////var/lib/neutron/ovs.sqlite',
$database_idle_timeout = $::os_service_default,
@ -41,6 +46,7 @@ class neutron::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,
) {
# NOTE(spredzy): In order to keep backward compatibility we rely on the pick function
@ -66,6 +72,7 @@ class neutron::db (
retry_interval => $database_retry_interval_real,
max_pool_size => $database_max_pool_size_real,
max_overflow => $database_max_overflow_real,
db_max_retries => $database_db_max_retries,
}
}

View File

@ -11,6 +11,7 @@ describe 'neutron::db' do
it { is_expected.to contain_neutron_config('database/min_pool_size').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_neutron_config('database/max_retries').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_neutron_config('database/retry_interval').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_neutron_config('database/db_max_retries').with_value('<SERVICE DEFAULT>') }
end
@ -20,7 +21,8 @@ describe 'neutron::db' do
:database_idle_timeout => '3601',
:database_min_pool_size => '2',
:database_max_retries => '11',
:database_retry_interval => '11', }
:database_retry_interval => '11',
:database_db_max_retries => '-1', }
end
it { is_expected.to contain_neutron_config('database/connection').with_value('mysql+pymysql://neutron:neutron@localhost/neutron').with_secret(true) }
@ -28,6 +30,7 @@ describe 'neutron::db' do
it { is_expected.to contain_neutron_config('database/min_pool_size').with_value('2') }
it { is_expected.to contain_neutron_config('database/max_retries').with_value('11') }
it { is_expected.to contain_neutron_config('database/retry_interval').with_value('11') }
it { is_expected.to contain_neutron_config('database/db_max_retries').with_value('-1') }
end