Support to configure [api_database] parameters
Change-Id: I3d086a0b7860590d6cdef8074ce201b7e10f3cb5
This commit is contained in:
parent
d07509e13d
commit
8c313ebdb9
@ -21,11 +21,6 @@
|
|||||||
#
|
#
|
||||||
# == Parameters
|
# == Parameters
|
||||||
#
|
#
|
||||||
# [*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 $::os_service_default
|
|
||||||
#
|
|
||||||
# [*database_connection*]
|
# [*database_connection*]
|
||||||
# (optional) Connection url to connect to nova database.
|
# (optional) Connection url to connect to nova database.
|
||||||
# Defaults to $::os_service_default
|
# Defaults to $::os_service_default
|
||||||
@ -34,14 +29,6 @@
|
|||||||
# (optional) Connection url to connect to nova slave database (read-only).
|
# (optional) Connection url to connect to nova slave database (read-only).
|
||||||
# Defaults to $::os_service_default
|
# Defaults to $::os_service_default
|
||||||
#
|
#
|
||||||
# [*api_database_connection*]
|
|
||||||
# (optional) Connection url to connect to nova api database.
|
|
||||||
# Defaults to $::os_service_default
|
|
||||||
#
|
|
||||||
# [*api_slave_connection*]
|
|
||||||
# (optional) Connection url to connect to nova api slave database (read-only).
|
|
||||||
# Defaults to $::os_service_default
|
|
||||||
#
|
|
||||||
# [*database_connection_recycle_time*]
|
# [*database_connection_recycle_time*]
|
||||||
# Timeout when db connections should be reaped.
|
# Timeout when db connections should be reaped.
|
||||||
# (Optional) Defaults to $::os_service_default
|
# (Optional) Defaults to $::os_service_default
|
||||||
@ -67,11 +54,49 @@
|
|||||||
# (Optional) If set, use this value for pool_timeout with SQLAlchemy.
|
# (Optional) If set, use this value for pool_timeout with SQLAlchemy.
|
||||||
# Defaults to $::os_service_default
|
# Defaults to $::os_service_default
|
||||||
#
|
#
|
||||||
|
# [*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 $::os_service_default
|
||||||
|
#
|
||||||
# [*mysql_enable_ndb*]
|
# [*mysql_enable_ndb*]
|
||||||
# (Optional) If True, transparently enables support for handling MySQL
|
# (Optional) If True, transparently enables support for handling MySQL
|
||||||
# Cluster (NDB).
|
# Cluster (NDB).
|
||||||
# Defaults to $::os_service_default
|
# Defaults to $::os_service_default
|
||||||
#
|
#
|
||||||
|
# [*api_database_connection*]
|
||||||
|
# (optional) Connection url to connect to nova api database.
|
||||||
|
# Defaults to $::os_service_default
|
||||||
|
#
|
||||||
|
# [*api_slave_connection*]
|
||||||
|
# (optional) Connection url to connect to nova api slave database (read-only).
|
||||||
|
# Defaults to $::os_service_default
|
||||||
|
#
|
||||||
|
# [*api_database_connection_recycle_time*]
|
||||||
|
# Timeout when nova api db connections should be reaped.
|
||||||
|
# (Optional) Defaults to $::os_service_default
|
||||||
|
#
|
||||||
|
# [*api_database_max_pool_size*]
|
||||||
|
# Maximum number of SQL connections to keep open in a pool.
|
||||||
|
# (Optional) Defaults to $::os_service_default
|
||||||
|
#
|
||||||
|
# [*api_database_max_retries*]
|
||||||
|
# Maximum db connection retries during startup.
|
||||||
|
# Setting -1 implies an infinite retry count.
|
||||||
|
# (Optional) Defaults to $::os_service_default
|
||||||
|
#
|
||||||
|
# [*api_database_retry_interval*]
|
||||||
|
# Interval between retries of opening a sql connection.
|
||||||
|
# (Optional) Defaults to $::os_service_default
|
||||||
|
#
|
||||||
|
# [*api_database_max_overflow*]
|
||||||
|
# If set, use this value for max_overflow with sqlalchemy.
|
||||||
|
# (Optional) Defaults to $::os_service_default
|
||||||
|
#
|
||||||
|
# [*api_database_pool_timeout*]
|
||||||
|
# (Optional) If set, use this value for pool_timeout with SQLAlchemy.
|
||||||
|
# Defaults to $::os_service_default
|
||||||
|
#
|
||||||
# DEPRECATED PARAMETERS
|
# DEPRECATED PARAMETERS
|
||||||
#
|
#
|
||||||
# [*database_min_pool_size*]
|
# [*database_min_pool_size*]
|
||||||
@ -79,20 +104,26 @@
|
|||||||
# (Optional) Defaults to undef
|
# (Optional) Defaults to undef
|
||||||
#
|
#
|
||||||
class nova::db (
|
class nova::db (
|
||||||
$database_db_max_retries = $::os_service_default,
|
$database_connection = $::os_service_default,
|
||||||
$database_connection = $::os_service_default,
|
$slave_connection = $::os_service_default,
|
||||||
$slave_connection = $::os_service_default,
|
$database_connection_recycle_time = $::os_service_default,
|
||||||
$api_database_connection = $::os_service_default,
|
$database_max_pool_size = $::os_service_default,
|
||||||
$api_slave_connection = $::os_service_default,
|
$database_max_retries = $::os_service_default,
|
||||||
$database_connection_recycle_time = $::os_service_default,
|
$database_retry_interval = $::os_service_default,
|
||||||
$database_max_pool_size = $::os_service_default,
|
$database_max_overflow = $::os_service_default,
|
||||||
$database_max_retries = $::os_service_default,
|
$database_pool_timeout = $::os_service_default,
|
||||||
$database_retry_interval = $::os_service_default,
|
$database_db_max_retries = $::os_service_default,
|
||||||
$database_max_overflow = $::os_service_default,
|
$mysql_enable_ndb = $::os_service_default,
|
||||||
$database_pool_timeout = $::os_service_default,
|
$api_database_connection = $::os_service_default,
|
||||||
$mysql_enable_ndb = $::os_service_default,
|
$api_slave_connection = $::os_service_default,
|
||||||
|
$api_database_connection_recycle_time = $::os_service_default,
|
||||||
|
$api_database_max_pool_size = $::os_service_default,
|
||||||
|
$api_database_max_retries = $::os_service_default,
|
||||||
|
$api_database_retry_interval = $::os_service_default,
|
||||||
|
$api_database_max_overflow = $::os_service_default,
|
||||||
|
$api_database_pool_timeout = $::os_service_default,
|
||||||
# DEPRECATED PARAMETERS
|
# DEPRECATED PARAMETERS
|
||||||
$database_min_pool_size = undef,
|
$database_min_pool_size = undef,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
include nova::deps
|
include nova::deps
|
||||||
@ -130,12 +161,18 @@ class nova::db (
|
|||||||
|
|
||||||
if !is_service_default($api_database_connection_real) {
|
if !is_service_default($api_database_connection_real) {
|
||||||
oslo::db { 'api_database':
|
oslo::db { 'api_database':
|
||||||
config => 'nova_config',
|
config => 'nova_config',
|
||||||
config_group => 'api_database',
|
config_group => 'api_database',
|
||||||
connection => $api_database_connection_real,
|
connection => $api_database_connection_real,
|
||||||
slave_connection => $api_slave_connection_real,
|
slave_connection => $api_slave_connection_real,
|
||||||
|
connection_recycle_time => $api_database_connection_recycle_time,
|
||||||
|
max_pool_size => $api_database_max_pool_size,
|
||||||
|
max_retries => $api_database_max_retries,
|
||||||
|
retry_interval => $api_database_retry_interval,
|
||||||
|
max_overflow => $api_database_max_overflow,
|
||||||
|
pool_timeout => $api_database_pool_timeout,
|
||||||
# Package management should be disabled here to avoid conflict.
|
# Package management should be disabled here to avoid conflict.
|
||||||
manage_backend_package => false
|
manage_backend_package => false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,11 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- |
|
||||||
|
Add the support to configure following parameters for api_database:
|
||||||
|
|
||||||
|
- ``nova::db::api_database_connection_recycle_time``
|
||||||
|
- ``nova::db::api_database_max_pool_size``
|
||||||
|
- ``nova::db::api_database_max_retries``
|
||||||
|
- ``nova::db::api_database_retry_interval``
|
||||||
|
- ``nova::db::api_database_max_overflow``
|
||||||
|
- ``nova::db::api_database_pool_timeout``
|
@ -7,33 +7,21 @@ describe 'nova::db' do
|
|||||||
|
|
||||||
shared_examples 'nova::db' do
|
shared_examples 'nova::db' do
|
||||||
context 'with default parameters' do
|
context 'with default parameters' do
|
||||||
it { should_not contain_nova_config('database/db_max_retries') }
|
it { should_not contain_oslo__db('nova_config') }
|
||||||
it { should_not contain_nova_config('database/connection') }
|
it { should_not contain_oslo__db('api_database') }
|
||||||
it { should_not contain_nova_config('database/slave_connection') }
|
|
||||||
it { should_not contain_nova_config('api_database/connection') }
|
|
||||||
it { should_not contain_nova_config('api_database/slave_connection') }
|
|
||||||
it { should_not contain_nova_config('database/connection_recycle_time') }
|
|
||||||
it { should_not contain_nova_config('database/max_pool_size') }
|
|
||||||
it { should_not contain_nova_config('database/max_retries') }
|
|
||||||
it { should_not contain_nova_config('database/retry_interval') }
|
|
||||||
it { should_not contain_nova_config('database/max_overflow') }
|
|
||||||
it { should_not contain_nova_config('database/pool_timeout') }
|
|
||||||
it { should_not contain_nova_config('database/mysql_enable_ndb') }
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with overridden parameters' do
|
context 'with connection parameters' do
|
||||||
before :each do
|
before :each do
|
||||||
params.merge!(
|
params.merge!(
|
||||||
:database_connection => 'mysql+pymysql://user:pass@db/db1',
|
:database_connection => 'mysql+pymysql://user:pass@db/db1',
|
||||||
:slave_connection => 'mysql+pymysql://user:pass@slave/db1',
|
:api_database_connection => 'mysql+pymysql://user:pass@db/db2'
|
||||||
:api_database_connection => 'mysql+pymysql://user:pass@db/db2',
|
|
||||||
:api_slave_connection => 'mysql+pymysql://user:pass@slave/db2',
|
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
it { should contain_oslo__db('nova_config').with(
|
it { should contain_oslo__db('nova_config').with(
|
||||||
:connection => 'mysql+pymysql://user:pass@db/db1',
|
:connection => 'mysql+pymysql://user:pass@db/db1',
|
||||||
:slave_connection => 'mysql+pymysql://user:pass@slave/db1',
|
:slave_connection => '<SERVICE DEFAULT>',
|
||||||
:db_max_retries => '<SERVICE DEFAULT>',
|
:db_max_retries => '<SERVICE DEFAULT>',
|
||||||
:connection_recycle_time => '<SERVICE DEFAULT>',
|
:connection_recycle_time => '<SERVICE DEFAULT>',
|
||||||
:max_pool_size => '<SERVICE DEFAULT>',
|
:max_pool_size => '<SERVICE DEFAULT>',
|
||||||
@ -43,12 +31,68 @@ describe 'nova::db' do
|
|||||||
:pool_timeout => '<SERVICE DEFAULT>',
|
:pool_timeout => '<SERVICE DEFAULT>',
|
||||||
:mysql_enable_ndb => '<SERVICE DEFAULT>',
|
:mysql_enable_ndb => '<SERVICE DEFAULT>',
|
||||||
)}
|
)}
|
||||||
|
it { should contain_oslo__db('api_database').with(
|
||||||
|
:config => 'nova_config',
|
||||||
|
:config_group => 'api_database',
|
||||||
|
:connection => 'mysql+pymysql://user:pass@db/db2',
|
||||||
|
:slave_connection => '<SERVICE DEFAULT>',
|
||||||
|
:connection_recycle_time => '<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 overridden parameters' do
|
||||||
|
before :each do
|
||||||
|
params.merge!(
|
||||||
|
:database_connection => 'mysql+pymysql://user:pass@db/db1',
|
||||||
|
:slave_connection => 'mysql+pymysql://user:pass@slave/db1',
|
||||||
|
:database_connection_recycle_time => '1800',
|
||||||
|
:database_max_pool_size => '30',
|
||||||
|
:database_max_retries => '20',
|
||||||
|
:database_retry_interval => '15',
|
||||||
|
:database_max_overflow => '5',
|
||||||
|
:database_pool_timeout => '20',
|
||||||
|
:database_db_max_retries => '10',
|
||||||
|
:mysql_enable_ndb => 'true',
|
||||||
|
:api_database_connection => 'mysql+pymysql://user:pass@db/db2',
|
||||||
|
:api_slave_connection => 'mysql+pymysql://user:pass@slave/db2',
|
||||||
|
:api_database_connection_recycle_time => '600',
|
||||||
|
:api_database_max_pool_size => '20',
|
||||||
|
:api_database_max_retries => '10',
|
||||||
|
:api_database_retry_interval => '5',
|
||||||
|
:api_database_max_overflow => '0',
|
||||||
|
:api_database_pool_timeout => '30',
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
it { should contain_oslo__db('nova_config').with(
|
||||||
|
:connection => 'mysql+pymysql://user:pass@db/db1',
|
||||||
|
:slave_connection => 'mysql+pymysql://user:pass@slave/db1',
|
||||||
|
:connection_recycle_time => '1800',
|
||||||
|
:max_pool_size => '30',
|
||||||
|
:max_retries => '20',
|
||||||
|
:retry_interval => '15',
|
||||||
|
:max_overflow => '5',
|
||||||
|
:pool_timeout => '20',
|
||||||
|
:db_max_retries => '10',
|
||||||
|
:mysql_enable_ndb => 'true',
|
||||||
|
)}
|
||||||
|
|
||||||
it { should contain_oslo__db('api_database').with(
|
it { should contain_oslo__db('api_database').with(
|
||||||
:config => 'nova_config',
|
:config => 'nova_config',
|
||||||
:config_group => 'api_database',
|
:config_group => 'api_database',
|
||||||
:connection => 'mysql+pymysql://user:pass@db/db2',
|
:connection => 'mysql+pymysql://user:pass@db/db2',
|
||||||
:slave_connection => 'mysql+pymysql://user:pass@slave/db2',
|
:slave_connection => 'mysql+pymysql://user:pass@slave/db2',
|
||||||
|
:connection_recycle_time => '600',
|
||||||
|
:max_pool_size => '20',
|
||||||
|
:max_retries => '10',
|
||||||
|
:retry_interval => '5',
|
||||||
|
:max_overflow => '0',
|
||||||
|
:pool_timeout => '30',
|
||||||
)}
|
)}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user