From 992aa924fe279c14d98739339bef51c6026c63c6 Mon Sep 17 00:00:00 2001 From: Tri Hoang Vo Date: Wed, 24 Sep 2014 15:50:08 +0200 Subject: [PATCH] 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 --- manifests/init.pp | 49 +++++++++++++++++++++++++++++++++++++ spec/classes/cinder_spec.rb | 11 +++++++++ 2 files changed, 60 insertions(+) diff --git a/manifests/init.pp b/manifests/init.pp index 717b1f41..9c674c88 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -9,6 +9,27 @@ # Timeout when db connections should be reaped. # (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*] # (optional) Connect over SSL for RabbitMQ # Defaults to false @@ -85,6 +106,11 @@ class cinder ( $database_connection = 'sqlite:////var/lib/cinder/cinder.sqlite', $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', $control_exchange = 'openstack', $rabbit_host = '127.0.0.1', @@ -292,6 +318,9 @@ class cinder ( cinder_config { 'database/connection': value => $database_connection_real, secret => true; '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/debug': value => $debug; 'DEFAULT/api_paste_config': value => $api_paste_config; @@ -300,6 +329,26 @@ class cinder ( '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+/) { require 'mysql::bindings' require 'mysql::bindings::python' diff --git a/spec/classes/cinder_spec.rb b/spec/classes/cinder_spec.rb index 8d22a62f..04707309 100644 --- a/spec/classes/cinder_spec.rb +++ b/spec/classes/cinder_spec.rb @@ -52,6 +52,17 @@ describe 'cinder' do should contain_cinder_config('database/idle_timeout').with( :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( :value => false )