From 66705cb49a711b57f83f64ba619e7b170bae3bad Mon Sep 17 00:00:00 2001 From: ZhongShengping Date: Wed, 25 Mar 2020 14:53:41 +0800 Subject: [PATCH] Deprecate min_pool_size option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit min_pool_size option is not used,see: https://review.opendev.org/#/c/565090/ Change-Id: Iead3c6521de9d779845c44d9117b396e3348a8ec Closes-Bug: #1868511 --- manifests/db.pp | 19 ++++++++++++------- manifests/db_cfapi.pp | 18 ++++++++++++------ manifests/init.pp | 10 +++++----- ...min_pool_size-option-ad06e672b28f06b0.yaml | 4 ++++ spec/classes/murano_db_cfapi_spec.rb | 3 --- spec/classes/murano_db_spec.rb | 3 --- 6 files changed, 33 insertions(+), 24 deletions(-) create mode 100644 releasenotes/notes/deprecate_database_min_pool_size-option-ad06e672b28f06b0.yaml diff --git a/manifests/db.pp b/manifests/db.pp index 6762360..90a5a85 100644 --- a/manifests/db.pp +++ b/manifests/db.pp @@ -21,10 +21,6 @@ # (optional) Interval between retries of opening a database connection. # Defaults to $::os_service_default. # -# [*database_min_pool_size*] -# (optional) Minimum number of SQL connections to keep open in a pool. -# Defaults to $::os_service_default. -# # [*database_max_pool_size*] # (optional) Maximum number of SQL connections to keep open in a pool. # Defaults to $::os_service_default. @@ -42,25 +38,35 @@ # before error is raised. Set to -1 to specify an infinite retry count. # Defaults to $::os_service_default # +# DEPRECATED PARAMETERS +# +# [*database_min_pool_size*] +# (optional) Minimum number of SQL connections to keep open in a pool. +# Defaults to undef. +# class murano::db ( $database_connection = 'mysql+pymysql://murano:secrete@localhost:3306/murano', $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, $database_db_max_retries = $::os_service_default, + # DEPRECATED PARAMETERS + $database_min_pool_size = undef, ) { include murano::deps + if $::murano::database_min_pool_size or $database_min_pool_size { + warning('The database_min_pool_size parameter is deprecated, and will be removed in a future release.') + } + # NOTE(aderyugin): In order to keep backward compatibility we rely on the pick function # to use murano:: if murano::db:: isn't specified. $database_connection_real = pick($::murano::database_connection, $database_connection) $database_connection_recycle_time_real = pick($::murano::database_idle_timeout, $database_connection_recycle_time) - $database_min_pool_size_real = pick($::murano::database_min_pool_size, $database_min_pool_size) $database_max_pool_size_real = pick($::murano::database_max_pool_size, $database_max_pool_size) $database_max_retries_real = pick($::murano::database_max_retries, $database_max_retries) $database_retry_interval_real = pick($::murano::database_retry_interval, $database_retry_interval) @@ -72,7 +78,6 @@ class murano::db ( oslo::db { 'murano_config': connection => $database_connection_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, retry_interval => $database_retry_interval_real, diff --git a/manifests/db_cfapi.pp b/manifests/db_cfapi.pp index 968df42..78c1fab 100644 --- a/manifests/db_cfapi.pp +++ b/manifests/db_cfapi.pp @@ -21,10 +21,6 @@ # (optional) Interval between retries of opening a database connection. # Defaults to $::os_service_default. # -# [*database_min_pool_size*] -# (optional) Minimum number of SQL connections to keep open in a pool. -# Defaults to $::os_service_default. -# # [*database_max_pool_size*] # (optional) Maximum number of SQL connections to keep open in a pool. # Defaults to $::os_service_default. @@ -38,19 +34,30 @@ # before error is raised. Set to -1 to specify an infinite retry count. # Defaults to $::os_service_default # +# DEPRECATED PARAMETERS +# +# [*database_min_pool_size*] +# (optional) Minimum number of SQL connections to keep open in a pool. +# Defaults to undef. +# class murano::db_cfapi ( $database_connection = $::os_service_default, $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_db_max_retries = $::os_service_default, + # DEPRECATED PARAMETERS + $database_min_pool_size = undef, ) { include murano::deps + if $database_min_pool_size { + warning('The database_min_pool_size parameter is deprecated, and will be removed in a future release.') + } + if !is_service_default($database_connection) { validate_legacy(Oslo::Dbconn, 'validate_re', $database_connection, @@ -59,7 +66,6 @@ class murano::db_cfapi ( oslo::db { 'murano_cfapi_config': connection => $database_connection, idle_timeout => $database_idle_timeout, - min_pool_size => $database_min_pool_size, max_pool_size => $database_max_pool_size, max_retries => $database_max_retries, retry_interval => $database_retry_interval, diff --git a/manifests/init.pp b/manifests/init.pp index e595bf8..fd0b8f4 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -190,10 +190,6 @@ # (optional) Interval between retries of opening a database connection. # Defaults to undef. # -# [*database_min_pool_size*] -# (optional) Minimum number of SQL connections to keep open in a pool. -# Defaults to undef. -# # [*database_max_pool_size*] # (optional) Maximum number of SQL connections to keep open in a pool. # Defaults to undef. @@ -247,6 +243,10 @@ # (Optional) Admin identity endpoint # Defaults to 'http://127.0.0.1:5000/' # +# [*database_min_pool_size*] +# (optional) Minimum number of SQL connections to keep open in a pool. +# Defaults to undef. +# class murano( $admin_password, $package_ensure = 'present', @@ -288,7 +288,6 @@ class murano( $packages_service = $::os_service_default, $database_connection = undef, $database_idle_timeout = undef, - $database_min_pool_size = undef, $database_max_pool_size = undef, $database_max_retries = undef, $database_retry_interval = undef, @@ -304,6 +303,7 @@ class murano( $amqp_durable_queues = $::os_service_default, # Deprecated $identity_uri = 'http://127.0.0.1:5000/', + $database_min_pool_size = undef, ) inherits murano::params { include murano::deps diff --git a/releasenotes/notes/deprecate_database_min_pool_size-option-ad06e672b28f06b0.yaml b/releasenotes/notes/deprecate_database_min_pool_size-option-ad06e672b28f06b0.yaml new file mode 100644 index 0000000..03e58c2 --- /dev/null +++ b/releasenotes/notes/deprecate_database_min_pool_size-option-ad06e672b28f06b0.yaml @@ -0,0 +1,4 @@ +--- +deprecations: + - database_min_pool_size option is now deprecated for removal, the + parameter has no effect. diff --git a/spec/classes/murano_db_cfapi_spec.rb b/spec/classes/murano_db_cfapi_spec.rb index dfd2e64..21b84a3 100644 --- a/spec/classes/murano_db_cfapi_spec.rb +++ b/spec/classes/murano_db_cfapi_spec.rb @@ -7,7 +7,6 @@ describe 'murano::db_cfapi' do context 'with default parameters' do it { is_expected.to_not contain_murano_cfapi_config('database/connection') } it { is_expected.to_not contain_murano_cfapi_config('database/idle_timeout') } - it { is_expected.to_not contain_murano_cfapi_config('database/min_pool_size') } it { is_expected.to_not contain_murano_cfapi_config('database/max_retries') } it { is_expected.to_not contain_murano_cfapi_config('database/retry_interval') } it { is_expected.to_not contain_murano_cfapi_config('database/max_pool_size') } @@ -19,7 +18,6 @@ describe 'murano::db_cfapi' do let :params do { :database_connection => 'mysql+pymysql://murano_cfapi:murano_cfapi@localhost/murano_cfapi', :database_idle_timeout => '3601', - :database_min_pool_size => '2', :database_max_retries => '11', :database_retry_interval => '11', :database_max_pool_size => '11', @@ -31,7 +29,6 @@ describe 'murano::db_cfapi' do it { should contain_oslo__db('murano_cfapi_config').with( :connection => 'mysql+pymysql://murano_cfapi:murano_cfapi@localhost/murano_cfapi', :idle_timeout => '3601', - :min_pool_size => '2', :max_pool_size => '11', :max_retries => '11', :retry_interval => '11', diff --git a/spec/classes/murano_db_spec.rb b/spec/classes/murano_db_spec.rb index 855d530..24967fe 100644 --- a/spec/classes/murano_db_spec.rb +++ b/spec/classes/murano_db_spec.rb @@ -7,7 +7,6 @@ describe 'murano::db' do :db_max_retries => '', :connection => 'mysql+pymysql://murano:secrete@localhost:3306/murano', :connection_recycle_time => '', - :min_pool_size => '', :max_pool_size => '', :max_retries => '', :retry_interval => '', @@ -21,7 +20,6 @@ describe 'murano::db' do { :database_connection => 'mysql+pymysql://murano:murano@localhost/murano', :database_connection_recycle_time => '3601', - :database_min_pool_size => '2', :database_max_retries => '11', :database_retry_interval => '11', :database_max_pool_size => '11', @@ -35,7 +33,6 @@ describe 'murano::db' do :db_max_retries => '-1', :connection => 'mysql+pymysql://murano:murano@localhost/murano', :connection_recycle_time => '3601', - :min_pool_size => '2', :max_pool_size => '11', :max_retries => '11', :retry_interval => '11',