From 5e269a9f323dcc0383fc9203468d96a7fd63acab Mon Sep 17 00:00:00 2001 From: Rocky Date: Wed, 14 Oct 2020 22:24:43 +1100 Subject: [PATCH] Deprecate database options Change-Id: I05386140888a42d1bc83e4be38a812a7832c1904 --- manifests/init.pp | 136 ++++++++++++------ ...ate_database_options-8caf6460b39a132a.yaml | 14 ++ spec/classes/nova_api_spec.rb | 14 +- spec/classes/nova_conductor_spec.rb | 10 +- spec/classes/nova_metadata_spec.rb | 14 +- spec/classes/nova_scheduler_spec.rb | 10 +- 6 files changed, 129 insertions(+), 69 deletions(-) create mode 100644 releasenotes/notes/releasenotes/notes/deprecate_database_options-8caf6460b39a132a.yaml diff --git a/manifests/init.pp b/manifests/init.pp index 6d6ff377d..80b30d180 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -9,42 +9,6 @@ # (optional) The state of nova packages # Defaults to 'present' # -# [*database_connection*] -# (optional) Connection url for the nova database. -# Defaults to undef. -# -# [*slave_connection*] -# (optional) Connection url to connect to nova slave database (read-only). -# Defaults to undef. -# -# [*api_database_connection*] -# (optional) Connection url for the nova API database. -# Defaults to undef. -# -# [*api_slave_connection*] -# (optional) Connection url to connect to nova API slave database (read-only). -# Defaults to undef. -# -# [*database_max_retries*] -# (optional) Maximum database connection retries during startup. -# Defaults to undef. -# -# [*database_idle_timeout*] -# (optional) Timeout before idle database connections are reaped. -# Defaults to undef. -# -# [*database_retry_interval*] -# (optional) Interval between retries of opening a database connection. -# Defaults to undef. -# -# [*database_max_pool_size*] -# (optional) Maximum number of SQL connections to keep open in a pool. -# Defaults to undef. -# -# [*database_max_overflow*] -# (optional) If set, use this value for max_overflow with sqlalchemy. -# Defaults to: undef. -# # [*default_transport_url*] # (optional) A URL representing the messaging driver to use and its full # configuration. Transport URLs take the form: @@ -427,19 +391,46 @@ # (optional) Sets a version cap for messages sent to console services # Defaults to undef # +# [*database_connection*] +# (optional) Connection url for the nova database. +# Defaults to undef. +# +# [*slave_connection*] +# (optional) Connection url to connect to nova slave database (read-only). +# Defaults to undef. +# +# [*api_database_connection*] +# (optional) Connection url for the nova API database. +# Defaults to undef. +# +# [*api_slave_connection*] +# (optional) Connection url to connect to nova API slave database (read-only). +# Defaults to undef. +# +# [*database_max_retries*] +# (optional) Maximum database connection retries during startup. +# Defaults to undef. +# +# [*database_idle_timeout*] +# (optional) Timeout before idle database connections are reaped. +# Defaults to undef. +# +# [*database_retry_interval*] +# (optional) Interval between retries of opening a database connection. +# Defaults to undef. +# +# [*database_max_pool_size*] +# (optional) Maximum number of SQL connections to keep open in a pool. +# Defaults to undef. +# +# [*database_max_overflow*] +# (optional) If set, use this value for max_overflow with sqlalchemy. +# Defaults to: undef. +# class nova( $ensure_package = 'present', - $database_connection = undef, - $slave_connection = undef, - $api_database_connection = undef, - $api_slave_connection = undef, $block_device_allocate_retries = $::os_service_default, $block_device_allocate_retries_interval = $::os_service_default, - $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 = $::os_service_default, @@ -519,6 +510,15 @@ class nova( $os_region_name = undef, $cinder_catalog_info = undef, $upgrade_level_console = undef, + $database_connection = undef, + $slave_connection = undef, + $api_database_connection = undef, + $api_slave_connection = undef, + $database_idle_timeout = undef, + $database_max_pool_size = undef, + $database_max_retries = undef, + $database_retry_interval = undef, + $database_max_overflow = undef, ) inherits nova::params { include nova::deps @@ -546,6 +546,52 @@ in a future release. Use nova::cinder::catalog_info instead') no effect.') } + if $database_connection != undef { + warning('The database_connection parameter is deprecated and will be \ +removed in a future realse. Use nova::db::database_connection instead') + } + + if $slave_connection != undef { + warning('The slave_connection parameter is deprecated and will be \ +removed in a future realse. Use nova::db::slave_connection instead') + } + + if $api_database_connection != undef { + warning('The api_database_connection parameter is deprecated and will be \ +removed in a future realse. Use nova::db::api_database_connection instead') + } + + if $api_slave_connection != undef { + warning('The api_slave_connection parameter is deprecated and will be \ +removed in a future realse. Use nova::db::api_slave_connection instead') + } + + if $database_idle_timeout != undef { + warning('The database_idle_timeout parameter is deprecated and will be \ +removed in a future realse. Use nova::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 nova::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 nova::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 nova::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 nova::db::database_max_overflow instead') + } + if $use_ssl { if !$cert_file { fail('The cert_file parameter is required when use_ssl is set to true') diff --git a/releasenotes/notes/releasenotes/notes/deprecate_database_options-8caf6460b39a132a.yaml b/releasenotes/notes/releasenotes/notes/deprecate_database_options-8caf6460b39a132a.yaml new file mode 100644 index 000000000..b812065f3 --- /dev/null +++ b/releasenotes/notes/releasenotes/notes/deprecate_database_options-8caf6460b39a132a.yaml @@ -0,0 +1,14 @@ +--- +deprecations: + - | + The following options have been deprecated and take no effect, as those + options have been moved to nova::db class: + - ``nova::database_connection`` + - ``nova::slave_connection`` + - ``nova::api_database_connection`` + - ``nova::api_slave_connection`` + - ``nova::database_idle_timeout`` + - ``nova::database_max_overflow`` + - ``nova::database_max_pool_size`` + - ``nova::database_max_retries`` + - ``nova::database_retry_interval`` diff --git a/spec/classes/nova_api_spec.rb b/spec/classes/nova_api_spec.rb index 3f75865f0..5bfb99a0d 100644 --- a/spec/classes/nova_api_spec.rb +++ b/spec/classes/nova_api_spec.rb @@ -176,7 +176,7 @@ describe 'nova::api' do context 'with default database parameters' do let :pre_condition do - "include nova + "include nova::db class { 'nova::keystone::authtoken': password => 'a_big_secret', }" @@ -191,12 +191,12 @@ describe 'nova::api' do context 'with overridden database parameters' do let :pre_condition do - "class { 'nova': - database_connection => 'mysql://user:pass@db/db1', - slave_connection => 'mysql://user:pass@slave/db1', - api_database_connection => 'mysql://user:pass@db/db2', - api_slave_connection => 'mysql://user:pass@slave/db2', - database_idle_timeout => '30', + "class { 'nova::db': + database_connection => 'mysql://user:pass@db/db1', + slave_connection => 'mysql://user:pass@slave/db1', + api_database_connection => 'mysql://user:pass@db/db2', + api_slave_connection => 'mysql://user:pass@slave/db2', + database_connection_recycle_time => '30', } class { 'nova::keystone::authtoken': password => 'passw0rd', diff --git a/spec/classes/nova_conductor_spec.rb b/spec/classes/nova_conductor_spec.rb index db71a7632..f68f1cc26 100644 --- a/spec/classes/nova_conductor_spec.rb +++ b/spec/classes/nova_conductor_spec.rb @@ -62,7 +62,7 @@ describe 'nova::conductor' do context 'with default database parameters' do let :pre_condition do - "include nova" + "include nova::db" end it { is_expected.to_not contain_nova_config('database/connection') } @@ -72,10 +72,10 @@ describe 'nova::conductor' do context 'with overridden database parameters' do let :pre_condition do - "class { 'nova': - database_connection => 'mysql://user:pass@db/db', - slave_connection => 'mysql://user:pass@slave/db', - database_idle_timeout => '30', + "class { 'nova::db': + database_connection => 'mysql://user:pass@db/db', + slave_connection => 'mysql://user:pass@slave/db', + database_connection_recycle_time => '30', } " end diff --git a/spec/classes/nova_metadata_spec.rb b/spec/classes/nova_metadata_spec.rb index d442038e8..cf129952f 100644 --- a/spec/classes/nova_metadata_spec.rb +++ b/spec/classes/nova_metadata_spec.rb @@ -52,7 +52,7 @@ describe 'nova::metadata' do context 'with default database parameters' do let :pre_condition do - "include nova + "include nova::db class { 'nova::keystone::authtoken': password => 'a_big_secret', }" @@ -67,12 +67,12 @@ describe 'nova::metadata' do context 'with overridden database parameters' do let :pre_condition do - "class { 'nova': - database_connection => 'mysql://user:pass@db/db1', - slave_connection => 'mysql://user:pass@slave/db1', - api_database_connection => 'mysql://user:pass@db/db2', - api_slave_connection => 'mysql://user:pass@slave/db2', - database_idle_timeout => '30', + "class { 'nova::db': + database_connection => 'mysql://user:pass@db/db1', + slave_connection => 'mysql://user:pass@slave/db1', + api_database_connection => 'mysql://user:pass@db/db2', + api_slave_connection => 'mysql://user:pass@slave/db2', + database_connection_recycle_time => '30', } class { 'nova::keystone::authtoken': password => 'passw0rd', diff --git a/spec/classes/nova_scheduler_spec.rb b/spec/classes/nova_scheduler_spec.rb index 70be8e631..571eb81c4 100644 --- a/spec/classes/nova_scheduler_spec.rb +++ b/spec/classes/nova_scheduler_spec.rb @@ -140,7 +140,7 @@ describe 'nova::scheduler' do context 'with default database parameters' do let :pre_condition do - "include nova" + "include nova::db" end it { is_expected.to_not contain_nova_config('database/connection') } @@ -150,10 +150,10 @@ describe 'nova::scheduler' do context 'with overridden database parameters' do let :pre_condition do - "class { 'nova': - database_connection => 'mysql://user:pass@db/db', - slave_connection => 'mysql://user:pass@slave/db', - database_idle_timeout => '30', + "class { 'nova::db': + database_connection => 'mysql://user:pass@db/db', + slave_connection => 'mysql://user:pass@slave/db', + database_connection_recycle_time => '30', } " end