From 4ec9e954473698785a72b135a97859133630070a Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Tue, 20 Oct 2020 11:21:29 +0900 Subject: [PATCH] Deprecate database options from the cinder class ... because these options have been implemented in the cinder::db class. Change-Id: I3fb49fd3b7a1130d85aa077e1660debe3ee2aea5 --- manifests/init.pp | 93 ++++++++++++------- ...ate_database_options-3abedcf672a6650f.yaml | 12 +++ spec/classes/cinder_init_spec.rb | 16 +--- spec/classes/cinder_volume_spec.rb | 2 +- 4 files changed, 76 insertions(+), 47 deletions(-) create mode 100644 releasenotes/notes/deprecate_database_options-3abedcf672a6650f.yaml diff --git a/manifests/init.pp b/manifests/init.pp index 1a805e1b..63755ecb 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -197,31 +197,6 @@ # http://auth_url:5000/v3 # Defaults to $::os_service_default. # -# [*database_connection*] -# Url used to connect to database. -# (Optional) Defaults to undef. -# -# [*database_idle_timeout*] -# Timeout when db connections should be reaped. -# (Optional) Defaults to undef. -# -# [*database_max_pool_size*] -# Maximum number of SQL connections to keep open in a pool. -# (Optional) Defaults to undef. -# -# [*database_max_retries*] -# Maximum db connection retries during startup. -# Setting -1 implies an infinite retry count. -# (Optional) Defaults to undef. -# -# [*database_retry_interval*] -# Interval between retries of opening a sql connection. -# (Optional) Defaults to undef. -# -# [*database_max_overflow*] -# If set, use this value for max_overflow with sqlalchemy. -# (Optional) Defaults to undef. -# # [*storage_availability_zone*] # (optional) Availability zone of the node. # Defaults to 'nova' @@ -280,13 +255,32 @@ # Minimum number of SQL connections to keep open in a pool. # (Optional) Defaults to undef. # +# [*database_connection*] +# Url used to connect to database. +# (Optional) Defaults to undef. +# +# [*database_idle_timeout*] +# Timeout when db connections should be reaped. +# (Optional) Defaults to undef. +# +# [*database_max_pool_size*] +# Maximum number of SQL connections to keep open in a pool. +# (Optional) Defaults to undef. +# +# [*database_max_retries*] +# Maximum db connection retries during startup. +# Setting -1 implies an infinite retry count. +# (Optional) Defaults to undef. +# +# [*database_retry_interval*] +# Interval between retries of opening a sql connection. +# (Optional) Defaults to undef. +# +# [*database_max_overflow*] +# If set, use this value for max_overflow with sqlalchemy. +# (Optional) Defaults to undef. +# class cinder ( - $database_connection = undef, - $database_idle_timeout = undef, - $database_max_pool_size = undef, - $database_max_retries = undef, - $database_retry_interval = undef, - $database_max_overflow = undef, $default_transport_url = $::os_service_default, $rpc_response_timeout = $::os_service_default, $control_exchange = 'openstack', @@ -341,11 +335,48 @@ class cinder ( $backend_host = $::os_service_default, # DEPRECATED PARAMETERS $database_min_pool_size = undef, + $database_connection = undef, + $database_idle_timeout = undef, + $database_max_pool_size = undef, + $database_max_retries = undef, + $database_retry_interval = undef, + $database_max_overflow = undef, ) inherits cinder::params { include cinder::deps include cinder::db + if $database_connection != undef { + warning('The database_connection parameter is deprecated and will be \ +removed in a future realse. Use cinder::db::database_connection instead') + } + + if $database_idle_timeout != undef { + warning('The database_idle_timeout parameter is deprecated and will be \ +removed in a future realse. Use cinder::db::database_connection_recycle_time \ +instead') + } + + if $database_max_pool_size != undef { + warning('The database_max_pool_size parameter is deprecated and will be \ +removed in a future realse. Use cinder::db::database_max_pool_size instead') + } + + if $database_max_retries!= undef { + warning('The database_max_retries parameter is deprecated and will be \ +removed in a future realse. Use cinder::db::database_max_retries instead') + } + + if $database_retry_interval != undef { + warning('The database_retry_interval parameter is deprecated and will be \ +removed in a future realse. Use cinder::db::database_retry_interval instead') + } + + if $database_max_overflow != undef { + warning('The database_max_overflow parameter is deprecated and will be \ +removed in a future realse. Use cinder::db::database_max_overflow instead') + } + package { 'cinder': ensure => $package_ensure, name => $::cinder::params::package_name, diff --git a/releasenotes/notes/deprecate_database_options-3abedcf672a6650f.yaml b/releasenotes/notes/deprecate_database_options-3abedcf672a6650f.yaml new file mode 100644 index 00000000..9fd457e6 --- /dev/null +++ b/releasenotes/notes/deprecate_database_options-3abedcf672a6650f.yaml @@ -0,0 +1,12 @@ +--- +deprecations: + - | + The following options have been deprecated, as those options have been + moved to cinder::db class. + + - ``cinder::database_connection`` + - ``cinder::database_idle_timeout`` + - ``cinder::database_max_overflow`` + - ``cinder::database_max_pool_size`` + - ``cinder::database_max_retries`` + - ``cinder::database_retry_interval`` diff --git a/spec/classes/cinder_init_spec.rb b/spec/classes/cinder_init_spec.rb index 04b80af8..5b93c844 100644 --- a/spec/classes/cinder_init_spec.rb +++ b/spec/classes/cinder_init_spec.rb @@ -3,8 +3,7 @@ require 'spec_helper' describe 'cinder' do let :req_params do { - :database_connection => 'mysql+pymysql://user:password@host/database', - :lock_path => '/var/lock/cinder', + :lock_path => '/var/lock/cinder', } end @@ -15,7 +14,6 @@ describe 'cinder' do end it { is_expected.to contain_class('cinder::params') } - it { is_expected.to contain_class('mysql::bindings::python') } it { is_expected.to contain_resources('cinder_config').with_purge(false) } @@ -208,18 +206,6 @@ describe 'cinder' do } end - context 'with postgresql' do - let :params do - { - :database_connection => 'postgresql://user:drowssap@host/database', - } - end - - it { is_expected.not_to contain_class('mysql::python') } - it { is_expected.not_to contain_class('mysql::bindings') } - it { is_expected.not_to contain_class('mysql::bindings::python') } - end - context 'with APIs set for Mitaka (proposed)' do let :params do { diff --git a/spec/classes/cinder_volume_spec.rb b/spec/classes/cinder_volume_spec.rb index 18aa3f98..8192122a 100644 --- a/spec/classes/cinder_volume_spec.rb +++ b/spec/classes/cinder_volume_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' describe 'cinder::volume' do let :pre_condition do - "class { 'cinder': + "class { 'cinder::db': database_connection => 'mysql://a:b@c/d' }" end