Merge "Added missing DB params to init class"
This commit is contained in:
commit
cb406347fb
@ -6,7 +6,7 @@
|
||||
#
|
||||
# [*database_connection*]
|
||||
# (Optional) Url used to connect to database.
|
||||
# Defaults to "sqlite:////var/lib/octavia/octavia.sqlite".
|
||||
# Defaults to 'sqlite:////var/lib/octavia/octavia.sqlite'.
|
||||
#
|
||||
# [*database_idle_timeout*]
|
||||
# (Optional) Timeout when db connections should be reaped.
|
||||
@ -56,19 +56,30 @@ class octavia::db (
|
||||
|
||||
include ::octavia::deps
|
||||
|
||||
validate_re($database_connection,
|
||||
$database_connection_real = pick($::octavia::database_connection, $database_connection)
|
||||
$database_idle_timeout_real = pick($::octavia::database_idle_timeout, $database_idle_timeout)
|
||||
$database_min_pool_size_real = pick($::octavia::database_min_pool_size, $database_min_pool_size)
|
||||
$database_max_pool_size_real = pick($::octavia::database_max_pool_size, $database_max_pool_size)
|
||||
$database_max_retries_real = pick($::octavia::database_max_retries, $database_max_retries)
|
||||
$database_retry_interval_real = pick($::octavia::database_retry_interval, $database_retry_interval)
|
||||
$database_max_overflow_real = pick($::octavia::database_max_overflow, $database_max_overflow)
|
||||
$database_pool_timeout_real = pick($::octavia::database_pool_timeout, $database_pool_timeout)
|
||||
$database_db_max_retries_real = pick($::octavia::database_db_max_retries, $database_db_max_retries)
|
||||
|
||||
|
||||
validate_re($database_connection_real,
|
||||
'^(sqlite|mysql(\+pymysql)?|postgresql):\/\/(\S+:\S+@\S+\/\S+)?')
|
||||
|
||||
oslo::db { 'octavia_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,
|
||||
max_overflow => $database_max_overflow,
|
||||
pool_timeout => $database_pool_timeout,
|
||||
db_max_retries => $database_db_max_retries,
|
||||
connection => $database_connection_real,
|
||||
idle_timeout => $database_idle_timeout_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,
|
||||
max_overflow => $database_max_overflow_real,
|
||||
pool_timeout => $database_pool_timeout_real,
|
||||
db_max_retries => $database_db_max_retries_real,
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -174,6 +174,44 @@
|
||||
# in the octavia config.
|
||||
# Defaults to false.
|
||||
#
|
||||
# [*database_connection*]
|
||||
# (Optional) Url used to connect to database.
|
||||
# Defaults to undef.
|
||||
#
|
||||
# [*database_idle_timeout*]
|
||||
# (Optional) Timeout when db connections should be reaped.
|
||||
# Defaults to undef.
|
||||
#
|
||||
# [*database_max_retries*]
|
||||
# (Optional) Maximum number of database connection retries during startup.
|
||||
# Setting -1 implies an infinite retry count.
|
||||
# Defaults to undef.
|
||||
#
|
||||
# [*database_retry_interval*]
|
||||
# (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.
|
||||
#
|
||||
# [*database_max_overflow*]
|
||||
# (Optional) If set, use this value for max_overflow with sqlalchemy.
|
||||
# Defaults to undef.
|
||||
#
|
||||
# [*database_pool_timeout*]
|
||||
# (Optional) If set, use this value for pool_timeout with SQLAlchemy.
|
||||
# Defaults to undef.
|
||||
#
|
||||
# [*database_db_max_retries*]
|
||||
# (Optional) Maximum retries in case of connection error or deadlock error
|
||||
# before error is raised. Set to -1 to specify an infinite retry count.
|
||||
# Defaults to undef.
|
||||
#
|
||||
class octavia (
|
||||
$package_ensure = 'present',
|
||||
$default_transport_url = $::os_service_default,
|
||||
@ -212,9 +250,19 @@ class octavia (
|
||||
$notification_topics = $::os_service_default,
|
||||
$topic = 'octavia-rpc',
|
||||
$purge_config = false,
|
||||
$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,
|
||||
$database_max_overflow = undef,
|
||||
$database_pool_timeout = undef,
|
||||
$database_db_max_retries = undef,
|
||||
) inherits octavia::params {
|
||||
|
||||
include ::octavia::deps
|
||||
include ::octavia::db
|
||||
include ::octavia::logging
|
||||
|
||||
package { 'octavia':
|
||||
|
@ -94,6 +94,21 @@ describe 'octavia' do
|
||||
|
||||
end
|
||||
|
||||
context 'with default parameters' do
|
||||
it { is_expected.to contain_class('octavia::db') }
|
||||
it { is_expected.to contain_oslo__db('octavia_config').with(
|
||||
:db_max_retries => '<SERVICE DEFAULT>',
|
||||
:connection => 'sqlite:////var/lib/octavia/octavia.sqlite',
|
||||
: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>',
|
||||
)}
|
||||
end
|
||||
|
||||
context 'with kombu_reconnect_delay set to 5.0' do
|
||||
let :params do
|
||||
{ :kombu_reconnect_delay => '5.0' }
|
||||
|
Loading…
x
Reference in New Issue
Block a user