db: Support connection_recycle_time option
Change-Id: I47e1c76909e108b1ddfa365a913ed66565012387
This commit is contained in:
parent
1853364510
commit
ec2b643479
@ -16,6 +16,10 @@
|
||||
# (Optional) Connection url to connect to placement slave database (read-only).
|
||||
# Defaults to $facts['os_service_default']
|
||||
#
|
||||
# [*database_connection_recycle_time*]
|
||||
# Timeout when db connections should be reaped.
|
||||
# (Optional) Defaults to $facts['os_service_default']
|
||||
#
|
||||
# [*database_mysql_sql_mode*]
|
||||
# (Optional) The SQL mode to be used for MySQL sessions.
|
||||
# Defaults to $facts['os_service_default']
|
||||
@ -55,36 +59,38 @@
|
||||
# Defaults to $facts['os_service_default']
|
||||
#
|
||||
class placement::db (
|
||||
$database_sqlite_synchronous = $facts['os_service_default'],
|
||||
$database_connection = 'sqlite:////var/lib/placement/placement.sqlite',
|
||||
$database_slave_connection = $facts['os_service_default'],
|
||||
$database_mysql_sql_mode = $facts['os_service_default'],
|
||||
$database_max_pool_size = $facts['os_service_default'],
|
||||
$database_max_retries = $facts['os_service_default'],
|
||||
$database_retry_interval = $facts['os_service_default'],
|
||||
$database_max_overflow = $facts['os_service_default'],
|
||||
$database_connection_debug = $facts['os_service_default'],
|
||||
$database_connection_trace = $facts['os_service_default'],
|
||||
$database_pool_timeout = $facts['os_service_default'],
|
||||
$mysql_enable_ndb = $facts['os_service_default'],
|
||||
$database_sqlite_synchronous = $facts['os_service_default'],
|
||||
$database_connection = 'sqlite:////var/lib/placement/placement.sqlite',
|
||||
$database_slave_connection = $facts['os_service_default'],
|
||||
$database_connection_recycle_time = $facts['os_service_default'],
|
||||
$database_mysql_sql_mode = $facts['os_service_default'],
|
||||
$database_max_pool_size = $facts['os_service_default'],
|
||||
$database_max_retries = $facts['os_service_default'],
|
||||
$database_retry_interval = $facts['os_service_default'],
|
||||
$database_max_overflow = $facts['os_service_default'],
|
||||
$database_connection_debug = $facts['os_service_default'],
|
||||
$database_connection_trace = $facts['os_service_default'],
|
||||
$database_pool_timeout = $facts['os_service_default'],
|
||||
$mysql_enable_ndb = $facts['os_service_default'],
|
||||
) {
|
||||
|
||||
include placement::deps
|
||||
|
||||
oslo::db { 'placement_config':
|
||||
config_group => 'placement_database',
|
||||
sqlite_synchronous => $database_sqlite_synchronous,
|
||||
connection => $database_connection,
|
||||
slave_connection => $database_slave_connection,
|
||||
mysql_sql_mode => $database_mysql_sql_mode,
|
||||
max_pool_size => $database_max_pool_size,
|
||||
max_retries => $database_max_retries,
|
||||
retry_interval => $database_retry_interval,
|
||||
max_overflow => $database_max_overflow,
|
||||
connection_debug => $database_connection_debug,
|
||||
connection_trace => $database_connection_trace,
|
||||
pool_timeout => $database_pool_timeout,
|
||||
mysql_enable_ndb => $mysql_enable_ndb,
|
||||
config_group => 'placement_database',
|
||||
sqlite_synchronous => $database_sqlite_synchronous,
|
||||
connection => $database_connection,
|
||||
slave_connection => $database_slave_connection,
|
||||
connection_recycle_time => $database_connection_recycle_time,
|
||||
mysql_sql_mode => $database_mysql_sql_mode,
|
||||
max_pool_size => $database_max_pool_size,
|
||||
max_retries => $database_max_retries,
|
||||
retry_interval => $database_retry_interval,
|
||||
max_overflow => $database_max_overflow,
|
||||
connection_debug => $database_connection_debug,
|
||||
connection_trace => $database_connection_trace,
|
||||
pool_timeout => $database_pool_timeout,
|
||||
mysql_enable_ndb => $mysql_enable_ndb,
|
||||
}
|
||||
|
||||
# all db settings should be applied and all packages should be installed
|
||||
|
@ -0,0 +1,5 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
The new ``placement::db::database_connection_recycle_time`` parameter has
|
||||
been added.
|
@ -8,37 +8,39 @@ describe 'placement::db' do
|
||||
}
|
||||
|
||||
it { should contain_oslo__db('placement_config').with(
|
||||
:config_group => 'placement_database',
|
||||
:sqlite_synchronous => '<SERVICE DEFAULT>',
|
||||
:connection => 'sqlite:////var/lib/placement/placement.sqlite',
|
||||
:slave_connection => '<SERVICE DEFAULT>',
|
||||
:mysql_sql_mode => '<SERVICE DEFAULT>',
|
||||
:max_pool_size => '<SERVICE DEFAULT>',
|
||||
:max_retries => '<SERVICE DEFAULT>',
|
||||
:retry_interval => '<SERVICE DEFAULT>',
|
||||
:max_overflow => '<SERVICE DEFAULT>',
|
||||
:connection_debug => '<SERVICE DEFAULT>',
|
||||
:connection_trace => '<SERVICE DEFAULT>',
|
||||
:pool_timeout => '<SERVICE DEFAULT>',
|
||||
:mysql_enable_ndb => '<SERVICE DEFAULT>',
|
||||
:config_group => 'placement_database',
|
||||
:sqlite_synchronous => '<SERVICE DEFAULT>',
|
||||
:connection => 'sqlite:////var/lib/placement/placement.sqlite',
|
||||
:slave_connection => '<SERVICE DEFAULT>',
|
||||
:connection_recycle_time => '<SERVICE DEFAULT>',
|
||||
:mysql_sql_mode => '<SERVICE DEFAULT>',
|
||||
:max_pool_size => '<SERVICE DEFAULT>',
|
||||
:max_retries => '<SERVICE DEFAULT>',
|
||||
:retry_interval => '<SERVICE DEFAULT>',
|
||||
:max_overflow => '<SERVICE DEFAULT>',
|
||||
:connection_debug => '<SERVICE DEFAULT>',
|
||||
:connection_trace => '<SERVICE DEFAULT>',
|
||||
:pool_timeout => '<SERVICE DEFAULT>',
|
||||
:mysql_enable_ndb => '<SERVICE DEFAULT>',
|
||||
)}
|
||||
end
|
||||
|
||||
context 'with specific parameters' do
|
||||
let :params do
|
||||
{
|
||||
:database_sqlite_synchronous => true,
|
||||
:database_connection => 'mysql+pymysql://placement:placement@localhost/placement',
|
||||
:database_slave_connection => 'mysql+pymysql://placement2:placement2@localhost/placement2',
|
||||
:database_mysql_sql_mode => 'strict_mode',
|
||||
:database_max_pool_size => '8',
|
||||
:database_max_retries => '4',
|
||||
:database_retry_interval => '-1',
|
||||
:database_max_overflow => '2',
|
||||
:database_connection_debug => '100',
|
||||
:database_connection_trace => true,
|
||||
:database_pool_timeout => '10',
|
||||
:mysql_enable_ndb => true,
|
||||
:database_sqlite_synchronous => true,
|
||||
:database_connection => 'mysql+pymysql://placement:placement@localhost/placement',
|
||||
:database_slave_connection => 'mysql+pymysql://placement2:placement2@localhost/placement2',
|
||||
:database_connection_recycle_time => '3601',
|
||||
:database_mysql_sql_mode => 'strict_mode',
|
||||
:database_max_pool_size => '8',
|
||||
:database_max_retries => '4',
|
||||
:database_retry_interval => '-1',
|
||||
:database_max_overflow => '2',
|
||||
:database_connection_debug => '100',
|
||||
:database_connection_trace => true,
|
||||
:database_pool_timeout => '10',
|
||||
:mysql_enable_ndb => true,
|
||||
}
|
||||
end
|
||||
|
||||
@ -47,19 +49,20 @@ describe 'placement::db' do
|
||||
}
|
||||
|
||||
it { should contain_oslo__db('placement_config').with(
|
||||
:config_group => 'placement_database',
|
||||
:sqlite_synchronous => true,
|
||||
:connection => 'mysql+pymysql://placement:placement@localhost/placement',
|
||||
:slave_connection => 'mysql+pymysql://placement2:placement2@localhost/placement2',
|
||||
:mysql_sql_mode => 'strict_mode',
|
||||
:max_pool_size => '8',
|
||||
:max_retries => '4',
|
||||
:retry_interval => '-1',
|
||||
:max_overflow => '2',
|
||||
:connection_debug => '100',
|
||||
:connection_trace => true,
|
||||
:pool_timeout => '10',
|
||||
:mysql_enable_ndb => true,
|
||||
:config_group => 'placement_database',
|
||||
:sqlite_synchronous => true,
|
||||
:connection => 'mysql+pymysql://placement:placement@localhost/placement',
|
||||
:slave_connection => 'mysql+pymysql://placement2:placement2@localhost/placement2',
|
||||
:connection_recycle_time => '3601',
|
||||
:mysql_sql_mode => 'strict_mode',
|
||||
:max_pool_size => '8',
|
||||
:max_retries => '4',
|
||||
:retry_interval => '-1',
|
||||
:max_overflow => '2',
|
||||
:connection_debug => '100',
|
||||
:connection_trace => true,
|
||||
:pool_timeout => '10',
|
||||
:mysql_enable_ndb => true,
|
||||
)}
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user