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: I197e5de614d1b69e335e0f910cc1262bd7c85ed8 Closes-Bug: 1579718
This commit is contained in:
parent
96e98e24f0
commit
fffd82deec
|
@ -4,6 +4,11 @@
|
||||||
#
|
#
|
||||||
# === Parameters
|
# === 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*]
|
# [*database_connection*]
|
||||||
# Url used to connect to database.
|
# Url used to connect to database.
|
||||||
# (Optional) Defaults to 'sqlite:////var/lib/cinder/cinder.sqlite'
|
# (Optional) Defaults to 'sqlite:////var/lib/cinder/cinder.sqlite'
|
||||||
|
@ -34,6 +39,7 @@
|
||||||
# (Optional) Defaults to $::os_service_default
|
# (Optional) Defaults to $::os_service_default
|
||||||
#
|
#
|
||||||
class cinder::db (
|
class cinder::db (
|
||||||
|
$database_db_max_retries = $::os_service_default,
|
||||||
$database_connection = 'sqlite:////var/lib/cinder/cinder.sqlite',
|
$database_connection = 'sqlite:////var/lib/cinder/cinder.sqlite',
|
||||||
$database_idle_timeout = $::os_service_default,
|
$database_idle_timeout = $::os_service_default,
|
||||||
$database_min_pool_size = $::os_service_default,
|
$database_min_pool_size = $::os_service_default,
|
||||||
|
@ -57,6 +63,7 @@ class cinder::db (
|
||||||
'^(sqlite|mysql(\+pymysql)?|postgresql):\/\/(\S+:\S+@\S+\/\S+)?')
|
'^(sqlite|mysql(\+pymysql)?|postgresql):\/\/(\S+:\S+@\S+\/\S+)?')
|
||||||
|
|
||||||
oslo::db { 'cinder_config':
|
oslo::db { 'cinder_config':
|
||||||
|
db_max_retries => $database_db_max_retries,
|
||||||
connection => $database_connection_real,
|
connection => $database_connection_real,
|
||||||
idle_timeout => $database_idle_timeout_real,
|
idle_timeout => $database_idle_timeout_real,
|
||||||
min_pool_size => $database_min_pool_size_real,
|
min_pool_size => $database_min_pool_size_real,
|
||||||
|
|
|
@ -6,6 +6,7 @@ describe 'cinder::db' do
|
||||||
|
|
||||||
context 'with default parameters' do
|
context 'with default parameters' do
|
||||||
|
|
||||||
|
it { is_expected.to contain_cinder_config('database/db_max_retries').with_value('<SERVICE DEFAULT>') }
|
||||||
it { is_expected.to contain_cinder_config('database/connection').with_value('sqlite:////var/lib/cinder/cinder.sqlite').with_secret(true) }
|
it { is_expected.to contain_cinder_config('database/connection').with_value('sqlite:////var/lib/cinder/cinder.sqlite').with_secret(true) }
|
||||||
it { is_expected.to contain_cinder_config('database/idle_timeout').with_value('<SERVICE DEFAULT>') }
|
it { is_expected.to contain_cinder_config('database/idle_timeout').with_value('<SERVICE DEFAULT>') }
|
||||||
it { is_expected.to contain_cinder_config('database/min_pool_size').with_value('<SERVICE DEFAULT>') }
|
it { is_expected.to contain_cinder_config('database/min_pool_size').with_value('<SERVICE DEFAULT>') }
|
||||||
|
@ -16,13 +17,15 @@ describe 'cinder::db' do
|
||||||
|
|
||||||
context 'with specific parameters' do
|
context 'with specific parameters' do
|
||||||
let :params do
|
let :params do
|
||||||
{ :database_connection => 'mysql+pymysql://cinder:cinder@localhost/cinder',
|
{ :database_db_max_retries => '-1',
|
||||||
|
:database_connection => 'mysql+pymysql://cinder:cinder@localhost/cinder',
|
||||||
:database_idle_timeout => '3601',
|
:database_idle_timeout => '3601',
|
||||||
:database_min_pool_size => '2',
|
:database_min_pool_size => '2',
|
||||||
:database_max_retries => '11',
|
:database_max_retries => '11',
|
||||||
:database_retry_interval => '11', }
|
:database_retry_interval => '11', }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it { is_expected.to contain_cinder_config('database/db_max_retries').with_value('-1') }
|
||||||
it { is_expected.to contain_cinder_config('database/connection').with_value('mysql+pymysql://cinder:cinder@localhost/cinder').with_secret(true) }
|
it { is_expected.to contain_cinder_config('database/connection').with_value('mysql+pymysql://cinder:cinder@localhost/cinder').with_secret(true) }
|
||||||
it { is_expected.to contain_cinder_config('database/idle_timeout').with_value('3601') }
|
it { is_expected.to contain_cinder_config('database/idle_timeout').with_value('3601') }
|
||||||
it { is_expected.to contain_cinder_config('database/min_pool_size').with_value('2') }
|
it { is_expected.to contain_cinder_config('database/min_pool_size').with_value('2') }
|
||||||
|
|
Loading…
Reference in New Issue