Add pool_timeout option

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

Change-Id: I7d78a55b17b8609ec0d41dfc2dda8f0e0b85ce8f
Closes-Bug: #1757581
This commit is contained in:
ZhongShengping 2018-03-22 11:09:50 +08:00
parent 919fc8160a
commit dd9c1879ae
3 changed files with 13 additions and 0 deletions

View File

@ -75,6 +75,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 nova::db (
$database_db_max_retries = $::os_service_default,
$database_connection = $::os_service_default,
@ -89,6 +93,7 @@ class nova::db (
$database_max_retries = $::os_service_default,
$database_retry_interval = $::os_service_default,
$database_max_overflow = $::os_service_default,
$database_pool_timeout = $::os_service_default,
) {
include ::nova::deps
@ -130,6 +135,7 @@ class nova::db (
max_retries => $database_max_retries_real,
retry_interval => $database_retry_interval_real,
max_overflow => $database_max_overflow_real,
pool_timeout => $database_pool_timeout,
slave_connection => $slave_connection_real,
}
}

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

@ -22,6 +22,7 @@ describe 'nova::db' do
it { is_expected.to_not contain_nova_config('database/max_retries') }
it { is_expected.to_not contain_nova_config('database/retry_interval') }
it { is_expected.to_not contain_nova_config('database/max_overflow') }
it { is_expected.to_not contain_nova_config('database/pool_timeout') }
end
context 'with overriden parameters' do
@ -46,6 +47,7 @@ describe 'nova::db' do
:max_retries => '<SERVICE DEFAULT>',
:retry_interval => '<SERVICE DEFAULT>',
:max_overflow => '<SERVICE DEFAULT>',
:pool_timeout => '<SERVICE DEFAULT>',
)}
it { is_expected.to contain_nova_config('api_database/connection').with_value('mysql+pymysql://user:pass@db/db2').with_secret(true) }
it { is_expected.to contain_nova_config('api_database/slave_connection').with_value('mysql+pymysql://user:pass@slave/db2').with_secret(true) }