From c3c7c39e1c7e0b39c5cc78d4e6efaf7de2904248 Mon Sep 17 00:00:00 2001 From: Tobias Urdin Date: Tue, 13 Aug 2024 11:23:24 +0200 Subject: [PATCH] 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 --- manifests/db.pp | 6 ++++++ .../notes/keystone-db-slave-conn-4592ab5542773cb6.yaml | 4 ++++ spec/classes/keystone_db_spec.rb | 3 +++ 3 files changed, 13 insertions(+) create mode 100644 releasenotes/notes/keystone-db-slave-conn-4592ab5542773cb6.yaml diff --git a/manifests/db.pp b/manifests/db.pp index d21cafbde..c21959d20 100644 --- a/manifests/db.pp +++ b/manifests/db.pp @@ -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, diff --git a/releasenotes/notes/keystone-db-slave-conn-4592ab5542773cb6.yaml b/releasenotes/notes/keystone-db-slave-conn-4592ab5542773cb6.yaml new file mode 100644 index 000000000..46e229358 --- /dev/null +++ b/releasenotes/notes/keystone-db-slave-conn-4592ab5542773cb6.yaml @@ -0,0 +1,4 @@ +--- +features: + - | + Added ``database_slave_connection`` parameter to ``keystone::db`` class. diff --git a/spec/classes/keystone_db_spec.rb b/spec/classes/keystone_db_spec.rb index 70ee921b4..f059f1e4f 100644 --- a/spec/classes/keystone_db_spec.rb +++ b/spec/classes/keystone_db_spec.rb @@ -8,6 +8,7 @@ describe 'keystone::db' do it { should contain_oslo__db('keystone_config').with( :db_max_retries => '', :connection => 'sqlite:////var/lib/keystone/keystone.sqlite', + :slave_connection => '', :connection_recycle_time => '', :max_pool_size => '', :max_retries => '', @@ -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',