db: Support connection_recycle_time option

Change-Id: I47e1c76909e108b1ddfa365a913ed66565012387
This commit is contained in:
Takashi Kajinami 2024-08-03 03:24:30 +09:00
parent 1853364510
commit ec2b643479
3 changed files with 77 additions and 63 deletions

View File

@ -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']
@ -58,6 +62,7 @@ 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_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'],
@ -76,6 +81,7 @@ class placement::db (
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,

View File

@ -0,0 +1,5 @@
---
features:
- |
The new ``placement::db::database_connection_recycle_time`` parameter has
been added.

View File

@ -12,6 +12,7 @@ describe 'placement::db' do
: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>',
@ -30,6 +31,7 @@ describe 'placement::db' do
: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',
@ -51,6 +53,7 @@ describe 'placement::db' do
: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',