Deprecate database options

Change-Id: I05386140888a42d1bc83e4be38a812a7832c1904
This commit is contained in:
Rocky
2020-10-14 22:24:43 +11:00
parent 9a29c21175
commit 5e269a9f32
6 changed files with 129 additions and 69 deletions

View File

@@ -9,42 +9,6 @@
# (optional) The state of nova packages # (optional) The state of nova packages
# Defaults to 'present' # 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*] # [*default_transport_url*]
# (optional) A URL representing the messaging driver to use and its full # (optional) A URL representing the messaging driver to use and its full
# configuration. Transport URLs take the form: # configuration. Transport URLs take the form:
@@ -427,19 +391,46 @@
# (optional) Sets a version cap for messages sent to console services # (optional) Sets a version cap for messages sent to console services
# Defaults to undef # 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( class nova(
$ensure_package = 'present', $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 = $::os_service_default,
$block_device_allocate_retries_interval = $::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, $default_transport_url = $::os_service_default,
$rpc_response_timeout = $::os_service_default, $rpc_response_timeout = $::os_service_default,
$control_exchange = $::os_service_default, $control_exchange = $::os_service_default,
@@ -519,6 +510,15 @@ class nova(
$os_region_name = undef, $os_region_name = undef,
$cinder_catalog_info = undef, $cinder_catalog_info = undef,
$upgrade_level_console = 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 { ) inherits nova::params {
include nova::deps include nova::deps
@@ -546,6 +546,52 @@ in a future release. Use nova::cinder::catalog_info instead')
no effect.') 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 $use_ssl {
if !$cert_file { if !$cert_file {
fail('The cert_file parameter is required when use_ssl is set to true') fail('The cert_file parameter is required when use_ssl is set to true')

View File

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

View File

@@ -176,7 +176,7 @@ describe 'nova::api' do
context 'with default database parameters' do context 'with default database parameters' do
let :pre_condition do let :pre_condition do
"include nova "include nova::db
class { 'nova::keystone::authtoken': class { 'nova::keystone::authtoken':
password => 'a_big_secret', password => 'a_big_secret',
}" }"
@@ -191,12 +191,12 @@ describe 'nova::api' do
context 'with overridden database parameters' do context 'with overridden database parameters' do
let :pre_condition do let :pre_condition do
"class { 'nova': "class { 'nova::db':
database_connection => 'mysql://user:pass@db/db1', database_connection => 'mysql://user:pass@db/db1',
slave_connection => 'mysql://user:pass@slave/db1', slave_connection => 'mysql://user:pass@slave/db1',
api_database_connection => 'mysql://user:pass@db/db2', api_database_connection => 'mysql://user:pass@db/db2',
api_slave_connection => 'mysql://user:pass@slave/db2', api_slave_connection => 'mysql://user:pass@slave/db2',
database_idle_timeout => '30', database_connection_recycle_time => '30',
} }
class { 'nova::keystone::authtoken': class { 'nova::keystone::authtoken':
password => 'passw0rd', password => 'passw0rd',

View File

@@ -62,7 +62,7 @@ describe 'nova::conductor' do
context 'with default database parameters' do context 'with default database parameters' do
let :pre_condition do let :pre_condition do
"include nova" "include nova::db"
end end
it { is_expected.to_not contain_nova_config('database/connection') } it { is_expected.to_not contain_nova_config('database/connection') }
@@ -72,10 +72,10 @@ describe 'nova::conductor' do
context 'with overridden database parameters' do context 'with overridden database parameters' do
let :pre_condition do let :pre_condition do
"class { 'nova': "class { 'nova::db':
database_connection => 'mysql://user:pass@db/db', database_connection => 'mysql://user:pass@db/db',
slave_connection => 'mysql://user:pass@slave/db', slave_connection => 'mysql://user:pass@slave/db',
database_idle_timeout => '30', database_connection_recycle_time => '30',
} }
" "
end end

View File

@@ -52,7 +52,7 @@ describe 'nova::metadata' do
context 'with default database parameters' do context 'with default database parameters' do
let :pre_condition do let :pre_condition do
"include nova "include nova::db
class { 'nova::keystone::authtoken': class { 'nova::keystone::authtoken':
password => 'a_big_secret', password => 'a_big_secret',
}" }"
@@ -67,12 +67,12 @@ describe 'nova::metadata' do
context 'with overridden database parameters' do context 'with overridden database parameters' do
let :pre_condition do let :pre_condition do
"class { 'nova': "class { 'nova::db':
database_connection => 'mysql://user:pass@db/db1', database_connection => 'mysql://user:pass@db/db1',
slave_connection => 'mysql://user:pass@slave/db1', slave_connection => 'mysql://user:pass@slave/db1',
api_database_connection => 'mysql://user:pass@db/db2', api_database_connection => 'mysql://user:pass@db/db2',
api_slave_connection => 'mysql://user:pass@slave/db2', api_slave_connection => 'mysql://user:pass@slave/db2',
database_idle_timeout => '30', database_connection_recycle_time => '30',
} }
class { 'nova::keystone::authtoken': class { 'nova::keystone::authtoken':
password => 'passw0rd', password => 'passw0rd',

View File

@@ -140,7 +140,7 @@ describe 'nova::scheduler' do
context 'with default database parameters' do context 'with default database parameters' do
let :pre_condition do let :pre_condition do
"include nova" "include nova::db"
end end
it { is_expected.to_not contain_nova_config('database/connection') } it { is_expected.to_not contain_nova_config('database/connection') }
@@ -150,10 +150,10 @@ describe 'nova::scheduler' do
context 'with overridden database parameters' do context 'with overridden database parameters' do
let :pre_condition do let :pre_condition do
"class { 'nova': "class { 'nova::db':
database_connection => 'mysql://user:pass@db/db', database_connection => 'mysql://user:pass@db/db',
slave_connection => 'mysql://user:pass@slave/db', slave_connection => 'mysql://user:pass@slave/db',
database_idle_timeout => '30', database_connection_recycle_time => '30',
} }
" "
end end