Add pool_timeout option

Add pool_timeout option to configure this value for pool_timeout with
SQLAlchemy.

Closes-Bug: #1757581

Change-Id: Ia7b26a2243f06ff6d20fb10b32b355cfb8d41a41
This commit is contained in:
ZhongShengping 2018-05-23 15:29:46 +08:00
parent 9be8befb75
commit aca0919997
5 changed files with 23 additions and 0 deletions

View File

@ -38,6 +38,10 @@
# before error is raised. Set to -1 to specify an infinite retry count.
# Defaults to $::os_service_default
#
# [*database_pool_timeout*]
# (Optional) If set, use this value for pool_timeout with SQLAlchemy.
# Defaults to $::os_service_default
#
class ironic::db (
$database_connection = 'sqlite:////var/lib/ironic/ovs.sqlite',
$database_idle_timeout = $::os_service_default,
@ -47,6 +51,7 @@ class ironic::db (
$database_max_pool_size = $::os_service_default,
$database_max_overflow = $::os_service_default,
$database_db_max_retries = $::os_service_default,
$database_pool_timeout = $::os_service_default,
) {
include ::ironic::deps
@ -72,6 +77,7 @@ class ironic::db (
retry_interval => $database_retry_interval_real,
max_overflow => $database_max_overflow_real,
db_max_retries => $database_db_max_retries,
pool_timeout => $database_pool_timeout,
}
}

View File

@ -33,6 +33,10 @@
# If set, use this value for max_overflow with sqlalchemy.
# (Optional) Defaults to $::os_service_default
#
# [*database_pool_timeout*]
# (Optional) If set, use this value for pool_timeout with SQLAlchemy.
# Defaults to $::os_service_default
#
class ironic::inspector::db (
$database_connection = 'sqlite:////var/lib/ironic-inspector/inspector.sqlite',
$database_idle_timeout = $::os_service_default,
@ -41,6 +45,7 @@ class ironic::inspector::db (
$database_min_pool_size = $::os_service_default,
$database_max_pool_size = $::os_service_default,
$database_max_overflow = $::os_service_default,
$database_pool_timeout = $::os_service_default,
) {
include ::ironic::params
@ -58,6 +63,7 @@ class ironic::inspector::db (
max_retries => $database_max_retries,
retry_interval => $database_retry_interval,
max_overflow => $database_max_overflow,
pool_timeout => $database_pool_timeout,
}
}

View File

@ -0,0 +1,5 @@
---
features:
- |
Adds the pool_timeout option for configuring oslo.db. This will
configure this value for pool_timeout with SQLAlchemy.

View File

@ -13,6 +13,7 @@ describe 'ironic::db' do
:min_pool_size => '<SERVICE DEFAULT>',
:max_pool_size => '<SERVICE DEFAULT>',
:max_retries => '<SERVICE DEFAULT>',
:pool_timeout => '<SERVICE DEFAULT>',
:retry_interval => '<SERVICE DEFAULT>',
:max_overflow => '<SERVICE DEFAULT>',
)}
@ -26,6 +27,7 @@ describe 'ironic::db' do
:database_min_pool_size => '2',
:database_max_pool_size => '21',
:database_max_retries => '11',
:database_pool_timeout => '21',
:database_max_overflow => '21',
:database_retry_interval => '11',
:database_db_max_retries => '-1',
@ -41,6 +43,7 @@ describe 'ironic::db' do
:max_retries => '11',
:retry_interval => '11',
:max_overflow => '21',
:pool_timeout => '21',
)}
end

View File

@ -11,6 +11,7 @@ describe 'ironic::inspector::db' do
it { is_expected.to contain_ironic_inspector_config('database/min_pool_size').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_ironic_inspector_config('database/max_pool_size').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_ironic_inspector_config('database/max_overflow').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_ironic_inspector_config('database/pool_timeout').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_ironic_inspector_config('database/max_retries').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_ironic_inspector_config('database/retry_interval').with_value('<SERVICE DEFAULT>') }
@ -24,6 +25,7 @@ describe 'ironic::inspector::db' do
:database_max_pool_size => '21',
:database_max_retries => '11',
:database_max_overflow => '21',
:database_pool_timeout => '21',
:database_retry_interval => '11', }
end
@ -33,6 +35,7 @@ describe 'ironic::inspector::db' do
it { is_expected.to contain_ironic_inspector_config('database/max_retries').with_value('11') }
it { is_expected.to contain_ironic_inspector_config('database/max_pool_size').with_value('21') }
it { is_expected.to contain_ironic_inspector_config('database/max_overflow').with_value('21') }
it { is_expected.to contain_ironic_inspector_config('database/pool_timeout').with_value('21') }
it { is_expected.to contain_ironic_inspector_config('database/retry_interval').with_value('11') }
end