Browse Source

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: I739b592c9482a4a1e38457323e5497f27d64e1e2
Depends-On: https://review.opendev.org/656106/
Closes-Bug: #1826692
changes/44/656144/2 15.0.0
ZhongShengping 3 years ago
parent
commit
c7415121fc
  1. 54
      manifests/db.pp
  2. 4
      releasenotes/notes/deprecate_idle_timeout_parameter-98934c0a274f9bc2.yaml
  3. 56
      spec/classes/ceilometer_db_spec.rb

54
manifests/db.pp

@ -15,7 +15,7 @@
# (Optional) Url used to connect to database.
# Defaults to 'mysql+pymysql://ceilometer:ceilometer@localhost/ceilometer'.
#
# [*database_idle_timeout*]
# [*database_connection_recycle_time*]
# (Optional) Timeout when db connections should be reaped.
# Defaults to $::os_service_default.
#
@ -48,31 +48,45 @@
# (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 ceilometer::db (
$database_db_max_retries = $::os_service_default,
$database_connection = 'mysql+pymysql://ceilometer:ceilometer@localhost/ceilometer',
$database_idle_timeout = $::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,
$sync_db = true,
$database_db_max_retries = $::os_service_default,
$database_connection = 'mysql+pymysql://ceilometer:ceilometer@localhost/ceilometer',
$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,
$sync_db = true,
# DEPRECATED PARAMETERS
$database_idle_timeout = undef,
) {
include ::ceilometer::deps
if $database_idle_timeout {
warning('The database_idle_timeout parameter is deprecated. Please use \
database_connection_recycle_time instead.')
}
$database_connection_recycle_time_real = pick($database_idle_timeout, $database_connection_recycle_time)
oslo::db { 'ceilometer_config':
db_max_retries => $database_db_max_retries,
connection => $database_connection,
idle_timeout => $database_idle_timeout,
min_pool_size => $database_min_pool_size,
max_retries => $database_max_retries,
retry_interval => $database_retry_interval,
max_pool_size => $database_max_pool_size,
max_overflow => $database_max_overflow,
pool_timeout => $database_pool_timeout,
db_max_retries => $database_db_max_retries,
connection => $database_connection,
connection_recycle_time => $database_connection_recycle_time_real,
min_pool_size => $database_min_pool_size,
max_retries => $database_max_retries,
retry_interval => $database_retry_interval,
max_pool_size => $database_max_pool_size,
max_overflow => $database_max_overflow,
pool_timeout => $database_pool_timeout,
}
if $sync_db {

4
releasenotes/notes/deprecate_idle_timeout_parameter-98934c0a274f9bc2.yaml

@ -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.

56
spec/classes/ceilometer_db_spec.rb

@ -6,15 +6,15 @@ describe 'ceilometer::db' do
it { should contain_class('ceilometer::deps') }
it { should contain_oslo__db('ceilometer_config').with(
:db_max_retries => '<SERVICE DEFAULT>',
:connection => 'mysql+pymysql://ceilometer:ceilometer@localhost/ceilometer',
:idle_timeout => '<SERVICE DEFAULT>',
:min_pool_size => '<SERVICE DEFAULT>',
:max_pool_size => '<SERVICE DEFAULT>',
:max_retries => '<SERVICE DEFAULT>',
:retry_interval => '<SERVICE DEFAULT>',
:max_overflow => '<SERVICE DEFAULT>',
:pool_timeout => '<SERVICE DEFAULT>',
:db_max_retries => '<SERVICE DEFAULT>',
:connection => 'mysql+pymysql://ceilometer:ceilometer@localhost/ceilometer',
:connection_recycle_time => '<SERVICE DEFAULT>',
:min_pool_size => '<SERVICE DEFAULT>',
:max_pool_size => '<SERVICE DEFAULT>',
:max_retries => '<SERVICE DEFAULT>',
:retry_interval => '<SERVICE DEFAULT>',
:max_overflow => '<SERVICE DEFAULT>',
:pool_timeout => '<SERVICE DEFAULT>',
)}
it { should contain_class('ceilometer::db::sync') }
@ -23,30 +23,30 @@ describe 'ceilometer::db' do
context 'with specific parameters' do
let :params do
{
:database_db_max_retries => '-1',
:database_connection => 'mongodb://localhost:1234/ceilometer',
:database_idle_timeout => '3601',
:database_min_pool_size => '2',
:database_max_pool_size => '11',
:database_max_retries => '11',
:database_retry_interval => '11',
:database_max_overflow => '21',
:database_pool_timeout => '21',
:sync_db => false }
:database_db_max_retries => '-1',
:database_connection => 'mongodb://localhost:1234/ceilometer',
:database_connection_recycle_time => '3601',
:database_min_pool_size => '2',
:database_max_pool_size => '11',
:database_max_retries => '11',
:database_retry_interval => '11',
:database_max_overflow => '21',
:database_pool_timeout => '21',
:sync_db => false }
end
it { should contain_class('ceilometer::deps') }
it { should contain_oslo__db('ceilometer_config').with(
:db_max_retries => '-1',
:connection => 'mongodb://localhost:1234/ceilometer',
:idle_timeout => '3601',
:min_pool_size => '2',
:max_pool_size => '11',
:max_retries => '11',
:retry_interval => '11',
:max_overflow => '21',
:pool_timeout => '21',
:db_max_retries => '-1',
:connection => 'mongodb://localhost:1234/ceilometer',
:connection_recycle_time => '3601',
:min_pool_size => '2',
:max_pool_size => '11',
:max_retries => '11',
:retry_interval => '11',
:max_overflow => '21',
:pool_timeout => '21',
)}
it { should_not contain_class('ceilometer::db::sync') }

Loading…
Cancel
Save