Added missing DB params to init class
Change-Id: Idb9970c396ebbe8c857ade7b662ab7aed0557474
This commit is contained in:
@@ -6,7 +6,7 @@
|
|||||||
#
|
#
|
||||||
# [*database_connection*]
|
# [*database_connection*]
|
||||||
# (Optional) Url used to connect to database.
|
# (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*]
|
# [*database_idle_timeout*]
|
||||||
# (Optional) Timeout when db connections should be reaped.
|
# (Optional) Timeout when db connections should be reaped.
|
||||||
@@ -56,19 +56,30 @@ class octavia::db (
|
|||||||
|
|
||||||
include ::octavia::deps
|
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+)?')
|
'^(sqlite|mysql(\+pymysql)?|postgresql):\/\/(\S+:\S+@\S+\/\S+)?')
|
||||||
|
|
||||||
oslo::db { 'octavia_config':
|
oslo::db { 'octavia_config':
|
||||||
connection => $database_connection,
|
connection => $database_connection_real,
|
||||||
idle_timeout => $database_idle_timeout,
|
idle_timeout => $database_idle_timeout_real,
|
||||||
min_pool_size => $database_min_pool_size,
|
min_pool_size => $database_min_pool_size_real,
|
||||||
max_pool_size => $database_max_pool_size,
|
max_pool_size => $database_max_pool_size_real,
|
||||||
max_retries => $database_max_retries,
|
max_retries => $database_max_retries_real,
|
||||||
retry_interval => $database_retry_interval,
|
retry_interval => $database_retry_interval_real,
|
||||||
max_overflow => $database_max_overflow,
|
max_overflow => $database_max_overflow_real,
|
||||||
pool_timeout => $database_pool_timeout,
|
pool_timeout => $database_pool_timeout_real,
|
||||||
db_max_retries => $database_db_max_retries,
|
db_max_retries => $database_db_max_retries_real,
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -174,6 +174,44 @@
|
|||||||
# in the octavia config.
|
# in the octavia config.
|
||||||
# Defaults to false.
|
# 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 (
|
class octavia (
|
||||||
$package_ensure = 'present',
|
$package_ensure = 'present',
|
||||||
$default_transport_url = $::os_service_default,
|
$default_transport_url = $::os_service_default,
|
||||||
@@ -212,9 +250,19 @@ class octavia (
|
|||||||
$notification_topics = $::os_service_default,
|
$notification_topics = $::os_service_default,
|
||||||
$topic = 'octavia-rpc',
|
$topic = 'octavia-rpc',
|
||||||
$purge_config = false,
|
$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 {
|
) inherits octavia::params {
|
||||||
|
|
||||||
include ::octavia::deps
|
include ::octavia::deps
|
||||||
|
include ::octavia::db
|
||||||
include ::octavia::logging
|
include ::octavia::logging
|
||||||
|
|
||||||
package { 'octavia':
|
package { 'octavia':
|
||||||
|
|||||||
@@ -94,6 +94,21 @@ describe 'octavia' do
|
|||||||
|
|
||||||
end
|
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
|
context 'with kombu_reconnect_delay set to 5.0' do
|
||||||
let :params do
|
let :params do
|
||||||
{ :kombu_reconnect_delay => '5.0' }
|
{ :kombu_reconnect_delay => '5.0' }
|
||||||
|
|||||||
Reference in New Issue
Block a user