Add tuning data base configs

Add data base configs: min_pool_size, max_pool_size, max_retries,
retry_interval, max_overflow

Use the same default values as cinder project

Change-Id: Icfc545e41049ee6b3d05fb6770a12d5d2b683f93
This commit is contained in:
Tri Hoang Vo 2014-09-24 15:50:08 +02:00
parent 2da616a4a5
commit 992aa924fe
2 changed files with 60 additions and 0 deletions

View File

@ -9,6 +9,27 @@
# Timeout when db connections should be reaped. # Timeout when db connections should be reaped.
# (Optional) Defaults to 3600. # (Optional) Defaults to 3600.
# #
# [database_min_pool_size]
# Minimum number of SQL connections to keep open in a pool.
# (Optional) Defaults to 1.
#
# [database_max_pool_size]
# Maximum number of SQL connections to keep open in a pool.
# (Optional) Defaults to undef.
#
# [database_max_retries]
# Maximum db connection retries during startup.
# Setting -1 implies an infinite retry count.
# (Optional) Defaults to 10.
#
# [database_retry_interval]
# Interval between retries of opening a sql connection.
# (Optional) Defaults to 10.
#
# [database_max_overflow]
# If set, use this value for max_overflow with sqlalchemy.
# (Optional) Defaults to undef.
#
# [*rabbit_use_ssl*] # [*rabbit_use_ssl*]
# (optional) Connect over SSL for RabbitMQ # (optional) Connect over SSL for RabbitMQ
# Defaults to false # Defaults to false
@ -85,6 +106,11 @@
class cinder ( class cinder (
$database_connection = 'sqlite:////var/lib/cinder/cinder.sqlite', $database_connection = 'sqlite:////var/lib/cinder/cinder.sqlite',
$database_idle_timeout = '3600', $database_idle_timeout = '3600',
$database_min_pool_size = '1',
$database_max_pool_size = undef,
$database_max_retries = '10',
$database_retry_interval = '10',
$database_max_overflow = undef,
$rpc_backend = 'cinder.openstack.common.rpc.impl_kombu', $rpc_backend = 'cinder.openstack.common.rpc.impl_kombu',
$control_exchange = 'openstack', $control_exchange = 'openstack',
$rabbit_host = '127.0.0.1', $rabbit_host = '127.0.0.1',
@ -292,6 +318,9 @@ class cinder (
cinder_config { cinder_config {
'database/connection': value => $database_connection_real, secret => true; 'database/connection': value => $database_connection_real, secret => true;
'database/idle_timeout': value => $database_idle_timeout_real; 'database/idle_timeout': value => $database_idle_timeout_real;
'database/min_pool_size': value => $database_min_pool_size;
'database/max_retries': value => $database_max_retries;
'database/retry_interval': value => $database_retry_interval;
'DEFAULT/verbose': value => $verbose; 'DEFAULT/verbose': value => $verbose;
'DEFAULT/debug': value => $debug; 'DEFAULT/debug': value => $debug;
'DEFAULT/api_paste_config': value => $api_paste_config; 'DEFAULT/api_paste_config': value => $api_paste_config;
@ -300,6 +329,26 @@ class cinder (
'DEFAULT/default_availability_zone': value => $default_availability_zone_real; 'DEFAULT/default_availability_zone': value => $default_availability_zone_real;
} }
if $database_max_pool_size {
cinder_config {
'database/max_pool_size': value => $database_max_pool_size;
}
} else {
cinder_config {
'database/max_pool_size': ensure => absent;
}
}
if $database_max_overflow {
cinder_config {
'database/max_overflow': value => $database_max_overflow;
}
} else {
cinder_config {
'database/max_overflow': ensure => absent;
}
}
if($database_connection_real =~ /mysql:\/\/\S+:\S+@\S+\/\S+/) { if($database_connection_real =~ /mysql:\/\/\S+:\S+@\S+\/\S+/) {
require 'mysql::bindings' require 'mysql::bindings'
require 'mysql::bindings::python' require 'mysql::bindings::python'

View File

@ -52,6 +52,17 @@ describe 'cinder' do
should contain_cinder_config('database/idle_timeout').with( should contain_cinder_config('database/idle_timeout').with(
:value => '3600' :value => '3600'
) )
should contain_cinder_config('database/min_pool_size').with(
:value => '1'
)
should contain_cinder_config('database/max_pool_size').with_ensure('absent')
should contain_cinder_config('database/max_retries').with(
:value => '10'
)
should contain_cinder_config('database/retry_interval').with(
:value => '10'
)
should contain_cinder_config('database/max_overflow').with_ensure('absent')
should contain_cinder_config('DEFAULT/verbose').with( should contain_cinder_config('DEFAULT/verbose').with(
:value => false :value => false
) )