Deprecate idle_timeout option
The idle_timeout parameter is deprecated, use connection_recycle_time instead[1]. [1]https://review.opendev.org/#/c/334182/ Change-Id: Icdf42da63cc8bcb43c5320a1a1acf6a84682b706 Depends-On: https://review.opendev.org/656106/ Closes-Bug: #1826692
This commit is contained in:
@@ -42,7 +42,7 @@
|
||||
# (optional) Connection url to connect to nova api slave database (read-only).
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*database_idle_timeout*]
|
||||
# [*database_connection_recycle_time*]
|
||||
# Timeout when db connections should be reaped.
|
||||
# (Optional) Defaults to $::os_service_default
|
||||
#
|
||||
@@ -70,32 +70,45 @@
|
||||
# [*database_pool_timeout*]
|
||||
# (Optional) If set, use this value for pool_timeout with SQLAlchemy.
|
||||
# Defaults to $::os_service_default
|
||||
|
||||
#
|
||||
# DEPRECATED PARAMETERS
|
||||
#
|
||||
# [*database_idle_timeout*]
|
||||
# Timeout when db connections should be reaped.
|
||||
# Defaults to undef.
|
||||
#
|
||||
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,
|
||||
$api_slave_connection = $::os_service_default,
|
||||
$database_idle_timeout = $::os_service_default,
|
||||
$database_connection_recycle_time = $::os_service_default,
|
||||
$database_min_pool_size = $::os_service_default,
|
||||
$database_max_pool_size = $::os_service_default,
|
||||
$database_max_retries = $::os_service_default,
|
||||
$database_retry_interval = $::os_service_default,
|
||||
$database_max_overflow = $::os_service_default,
|
||||
$database_pool_timeout = $::os_service_default,
|
||||
# DEPRECATED PARAMETERS
|
||||
$database_idle_timeout = undef,
|
||||
) {
|
||||
|
||||
include ::nova::deps
|
||||
include ::nova::params
|
||||
|
||||
if $database_idle_timeout {
|
||||
warning('The database_idle_timeout parameter is deprecated. Please use \
|
||||
database_connection_recycle_time instead.')
|
||||
}
|
||||
|
||||
# NOTE(spredzy): In order to keep backward compatibility we rely on the pick function
|
||||
# to use nova::<myparam> first the nova::db::<myparam>
|
||||
$database_connection_real = pick($::nova::database_connection, $database_connection)
|
||||
$slave_connection_real = pick($::nova::slave_connection, $slave_connection)
|
||||
$api_database_connection_real = pick($::nova::api_database_connection, $api_database_connection)
|
||||
$api_slave_connection_real = pick($::nova::api_slave_connection, $api_slave_connection)
|
||||
$database_idle_timeout_real = pick($::nova::database_idle_timeout, $database_idle_timeout)
|
||||
$database_connection_recycle_time_real = pick($::nova::database_idle_timeout, $database_idle_timeout, $database_connection_recycle_time)
|
||||
$database_min_pool_size_real = pick($::nova::database_min_pool_size, $database_min_pool_size)
|
||||
$database_max_pool_size_real = pick($::nova::database_max_pool_size, $database_max_pool_size)
|
||||
$database_max_retries_real = pick($::nova::database_max_retries, $database_max_retries)
|
||||
@@ -110,7 +123,7 @@ class nova::db (
|
||||
oslo::db { 'nova_config':
|
||||
db_max_retries => $database_db_max_retries,
|
||||
connection => $database_connection_real,
|
||||
idle_timeout => $database_idle_timeout_real,
|
||||
connection_recycle_time => $database_connection_recycle_time_real,
|
||||
min_pool_size => $database_min_pool_size_real,
|
||||
max_pool_size => $database_max_pool_size_real,
|
||||
max_retries => $database_max_retries_real,
|
||||
|
@@ -0,0 +1,4 @@
|
||||
---
|
||||
deprecations:
|
||||
- database_idle_timeout is deprecated and will be removed in a future
|
||||
release. Please use database_connection_recycle_time instead.
|
@@ -219,7 +219,7 @@ describe 'nova::api' do
|
||||
it { is_expected.to_not contain_nova_config('database/slave_connection') }
|
||||
it { is_expected.to_not contain_nova_config('api_database/connection') }
|
||||
it { is_expected.to_not contain_nova_config('api_database/slave_connection') }
|
||||
it { is_expected.to_not contain_nova_config('database/idle_timeout').with_value('<SERVICE DEFAULT>') }
|
||||
it { is_expected.to_not contain_nova_config('database/connection_recycle_time').with_value('<SERVICE DEFAULT>') }
|
||||
end
|
||||
|
||||
context 'with overridden database parameters' do
|
||||
@@ -242,7 +242,7 @@ describe 'nova::api' do
|
||||
it { is_expected.to contain_oslo__db('nova_config').with(
|
||||
:connection => 'mysql://user:pass@db/db1',
|
||||
:slave_connection => 'mysql://user:pass@slave/db1',
|
||||
:idle_timeout => '30',
|
||||
:connection_recycle_time => '30',
|
||||
)}
|
||||
end
|
||||
|
||||
|
@@ -65,7 +65,7 @@ describe 'nova::conductor' do
|
||||
|
||||
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('database/idle_timeout').with_value('<SERVICE DEFAULT>') }
|
||||
it { is_expected.to_not contain_nova_config('database/connection_recycle_time').with_value('<SERVICE DEFAULT>') }
|
||||
end
|
||||
|
||||
context 'with overridden database parameters' do
|
||||
@@ -81,7 +81,7 @@ describe 'nova::conductor' do
|
||||
it { is_expected.to contain_oslo__db('nova_config').with(
|
||||
:connection => 'mysql://user:pass@db/db',
|
||||
:slave_connection => 'mysql://user:pass@slave/db',
|
||||
:idle_timeout => '30',
|
||||
:connection_recycle_time => '30',
|
||||
)}
|
||||
end
|
||||
|
||||
|
@@ -12,7 +12,7 @@ describe 'nova::db' do
|
||||
it { should_not contain_nova_config('database/slave_connection') }
|
||||
it { should_not contain_nova_config('api_database/connection') }
|
||||
it { should_not contain_nova_config('api_database/slave_connection') }
|
||||
it { should_not contain_nova_config('database/idle_timeout') }
|
||||
it { should_not contain_nova_config('database/connection_recycle_time') }
|
||||
it { should_not contain_nova_config('database/min_pool_size') }
|
||||
it { should_not contain_nova_config('database/max_pool_size') }
|
||||
it { should_not contain_nova_config('database/max_retries') }
|
||||
@@ -35,7 +35,7 @@ describe 'nova::db' do
|
||||
:connection => 'mysql+pymysql://user:pass@db/db1',
|
||||
:slave_connection => 'mysql+pymysql://user:pass@slave/db1',
|
||||
:db_max_retries => '<SERVICE DEFAULT>',
|
||||
:idle_timeout => '<SERVICE DEFAULT>',
|
||||
:connection_recycle_time => '<SERVICE DEFAULT>',
|
||||
:min_pool_size => '<SERVICE DEFAULT>',
|
||||
:max_pool_size => '<SERVICE DEFAULT>',
|
||||
:max_retries => '<SERVICE DEFAULT>',
|
||||
|
@@ -96,7 +96,7 @@ describe 'nova::metadata' do
|
||||
it { is_expected.to_not contain_nova_config('database/slave_connection') }
|
||||
it { is_expected.to_not contain_nova_config('api_database/connection') }
|
||||
it { is_expected.to_not contain_nova_config('api_database/slave_connection') }
|
||||
it { is_expected.to_not contain_nova_config('database/idle_timeout').with_value('<SERVICE DEFAULT>') }
|
||||
it { is_expected.to_not contain_nova_config('database/connection_recycle_time').with_value('<SERVICE DEFAULT>') }
|
||||
end
|
||||
|
||||
context 'with overridden database parameters' do
|
||||
@@ -119,7 +119,7 @@ describe 'nova::metadata' do
|
||||
it { is_expected.to contain_oslo__db('nova_config').with(
|
||||
:connection => 'mysql://user:pass@db/db1',
|
||||
:slave_connection => 'mysql://user:pass@slave/db1',
|
||||
:idle_timeout => '30',
|
||||
:connection_recycle_time => '30',
|
||||
)}
|
||||
end
|
||||
|
||||
|
@@ -73,7 +73,7 @@ describe 'nova::scheduler' do
|
||||
|
||||
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('database/idle_timeout').with_value('<SERVICE DEFAULT>') }
|
||||
it { is_expected.to_not contain_nova_config('database/connection_recycle_time').with_value('<SERVICE DEFAULT>') }
|
||||
end
|
||||
|
||||
context 'with overridden database parameters' do
|
||||
@@ -89,7 +89,7 @@ describe 'nova::scheduler' do
|
||||
it { is_expected.to contain_oslo__db('nova_config').with(
|
||||
:connection => 'mysql://user:pass@db/db',
|
||||
:slave_connection => 'mysql://user:pass@slave/db',
|
||||
:idle_timeout => '30',
|
||||
:connection_recycle_time => '30',
|
||||
)}
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user