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: Ic5c7d1be866ab25f4bb01a89253a3db92e4ee6f5 Closes-Bug: 1579718
This commit is contained in:
parent
6e13b38256
commit
28b9365947
|
@ -21,6 +21,11 @@
|
|||
#
|
||||
# == Parameters
|
||||
#
|
||||
# [*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
|
||||
#
|
||||
# [*database_connection*]
|
||||
# (optional) Connection url to connect to nova database.
|
||||
# Defaults to $::os_service_default
|
||||
|
@ -63,6 +68,7 @@
|
|||
# (Optional) Defaults to $::os_service_default
|
||||
#
|
||||
class nova::db (
|
||||
$database_db_max_retries = $::os_service_default,
|
||||
$database_connection = $::os_service_default,
|
||||
$slave_connection = $::os_service_default,
|
||||
$api_database_connection = $::os_service_default,
|
||||
|
@ -97,6 +103,7 @@ class nova::db (
|
|||
'^(sqlite|mysql(\+pymysql)?|postgresql):\/\/(\S+:\S+@\S+\/\S+)?')
|
||||
|
||||
oslo::db { 'nova_config':
|
||||
db_max_retries => $database_db_max_retries,
|
||||
connection => $database_connection_real,
|
||||
idle_timeout => $database_idle_timeout_real,
|
||||
min_pool_size => $database_min_pool_size_real,
|
||||
|
|
|
@ -9,6 +9,7 @@ describe 'nova::db' do
|
|||
shared_examples 'nova::db' do
|
||||
|
||||
context 'with default parameters' do
|
||||
it { is_expected.to_not contain_nova_config('database/db_max_retries') }
|
||||
it { is_expected.to_not contain_nova_config('database/connection') }
|
||||
it { is_expected.to_not contain_nova_config('database/slave_connection') }
|
||||
it { is_expected.to_not contain_nova_config('api_database/connection') }
|
||||
|
@ -29,6 +30,7 @@ describe 'nova::db' do
|
|||
)
|
||||
end
|
||||
|
||||
it { is_expected.to contain_nova_config('database/db_max_retries').with_value('<SERVICE DEFAULT>') }
|
||||
it { is_expected.to contain_nova_config('database/connection').with_value('mysql+pymysql://user:pass@db/db1').with_secret(true) }
|
||||
it { is_expected.to contain_nova_config('database/slave_connection').with_value('mysql+pymysql://user:pass@slave/db1').with_secret(true) }
|
||||
it { is_expected.to contain_nova_config('api_database/connection').with_value('mysql+pymysql://user:pass@db/db2').with_secret(true) }
|
||||
|
|
Loading…
Reference in New Issue