Add database_slave_connection to keystone::db class

This adds the database_slave_connection parameter to
the keystone::db class to configure a slave database
connection in oslo db.

Change-Id: I116611f9cf9d2c57536cece3f88c8e09829276bd
This commit is contained in:
Tobias Urdin 2024-08-13 11:23:24 +02:00
parent 19e9fcc6b7
commit c3c7c39e1c
3 changed files with 13 additions and 0 deletions

View File

@ -13,6 +13,10 @@
# Url used to connect to database.
# (Optional) Defaults to 'sqlite:////var/lib/keystone/keystone.sqlite'.
#
# [*database_slave_connection*]
# Url used to connect to slave database.
# (Optional) Defaults to $facts['os_service_default']
#
# [*database_connection_recycle_time*]
# Timeout when db connections should be reaped.
# (Optional) Defaults to $facts['os_service_default']
@ -46,6 +50,7 @@
class keystone::db (
$database_db_max_retries = $facts['os_service_default'],
$database_connection = 'sqlite:////var/lib/keystone/keystone.sqlite',
$database_slave_connection = $facts['os_service_default'],
$database_connection_recycle_time = $facts['os_service_default'],
$database_max_pool_size = $facts['os_service_default'],
$database_max_retries = $facts['os_service_default'],
@ -60,6 +65,7 @@ class keystone::db (
oslo::db { 'keystone_config':
db_max_retries => $database_db_max_retries,
connection => $database_connection,
slave_connection => $database_slave_connection,
connection_recycle_time => $database_connection_recycle_time,
max_pool_size => $database_max_pool_size,
max_retries => $database_max_retries,

View File

@ -0,0 +1,4 @@
---
features:
- |
Added ``database_slave_connection`` parameter to ``keystone::db`` class.

View File

@ -8,6 +8,7 @@ describe 'keystone::db' do
it { should contain_oslo__db('keystone_config').with(
:db_max_retries => '<SERVICE DEFAULT>',
:connection => 'sqlite:////var/lib/keystone/keystone.sqlite',
:slave_connection => '<SERVICE DEFAULT>',
:connection_recycle_time => '<SERVICE DEFAULT>',
:max_pool_size => '<SERVICE DEFAULT>',
:max_retries => '<SERVICE DEFAULT>',
@ -23,6 +24,7 @@ describe 'keystone::db' do
{
:database_db_max_retries => '-1',
:database_connection => 'mysql+pymysql://keystone:keystone@localhost/keystone',
:database_slave_connection => 'mysql+pymysql://keystone:keystone@replica/keystone',
:database_connection_recycle_time => '3601',
:database_max_pool_size => '21',
:database_max_retries => '11',
@ -38,6 +40,7 @@ describe 'keystone::db' do
it { should contain_oslo__db('keystone_config').with(
:db_max_retries => '-1',
:connection => 'mysql+pymysql://keystone:keystone@localhost/keystone',
:slave_connection => 'mysql+pymysql://keystone:keystone@replica/keystone',
:connection_recycle_time => '3601',
:max_pool_size => '21',
:max_retries => '11',