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: Ib3cfc7b27945389f523d7112d88462995e7416af Releated-Bug: #1579718
This commit is contained in:
parent
45bd308020
commit
efe9727528
@ -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/glance/glance.sqlite'.
|
# (Optional) Defaults to 'sqlite:///var/lib/glance/glance.sqlite'.
|
||||||
@ -34,6 +39,7 @@
|
|||||||
# (Optional) Defaults to $::os_service_default.
|
# (Optional) Defaults to $::os_service_default.
|
||||||
#
|
#
|
||||||
class glance::api::db (
|
class glance::api::db (
|
||||||
|
$database_db_max_retries = $::os_service_default,
|
||||||
$database_connection = 'sqlite:///var/lib/glance/glance.sqlite',
|
$database_connection = 'sqlite:///var/lib/glance/glance.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,
|
||||||
@ -59,6 +65,7 @@ class glance::api::db (
|
|||||||
'^(sqlite|mysql(\+pymysql)?|postgresql):\/\/(\S+:\S+@\S+\/\S+)?')
|
'^(sqlite|mysql(\+pymysql)?|postgresql):\/\/(\S+:\S+@\S+\/\S+)?')
|
||||||
|
|
||||||
oslo::db { 'glance_api_config':
|
oslo::db { 'glance_api_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,
|
||||||
|
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- Add new option glance::api::db::database_db_max_retries.
|
||||||
|
The database_db_max_retries parameter regulates the
|
||||||
|
number of reconnection attempts performed after an
|
||||||
|
error raised rather than at startup.
|
@ -5,6 +5,7 @@ describe 'glance::api::db' do
|
|||||||
shared_examples 'glance::api::db' do
|
shared_examples 'glance::api::db' do
|
||||||
context 'with default parameters' do
|
context 'with default parameters' do
|
||||||
it { is_expected.to contain_oslo__db('glance_api_config').with(
|
it { is_expected.to contain_oslo__db('glance_api_config').with(
|
||||||
|
:db_max_retries => '<SERVICE DEFAULT>',
|
||||||
:connection => 'sqlite:///var/lib/glance/glance.sqlite',
|
:connection => 'sqlite:///var/lib/glance/glance.sqlite',
|
||||||
:idle_timeout => '<SERVICE DEFAULT>',
|
:idle_timeout => '<SERVICE DEFAULT>',
|
||||||
:min_pool_size => '<SERVICE DEFAULT>',
|
:min_pool_size => '<SERVICE DEFAULT>',
|
||||||
@ -21,6 +22,7 @@ describe 'glance::api::db' do
|
|||||||
: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_db_max_retries => '-1',
|
||||||
:database_retry_interval => '11',
|
:database_retry_interval => '11',
|
||||||
:database_max_pool_size => '11',
|
:database_max_pool_size => '11',
|
||||||
:database_max_overflow => '21',
|
:database_max_overflow => '21',
|
||||||
@ -33,6 +35,7 @@ describe 'glance::api::db' do
|
|||||||
:min_pool_size => '2',
|
:min_pool_size => '2',
|
||||||
:max_pool_size => '11',
|
:max_pool_size => '11',
|
||||||
:max_retries => '11',
|
:max_retries => '11',
|
||||||
|
:db_max_retries => '-1',
|
||||||
:retry_interval => '11',
|
:retry_interval => '11',
|
||||||
:max_overflow => '21',
|
:max_overflow => '21',
|
||||||
)}
|
)}
|
||||||
|
Loading…
Reference in New Issue
Block a user