Add support for SQL idle timeout.
Previously, OpenStack services logged frequent database-has-gone-away errors. This patch adds a parameter that can configure the sql_idle_timeout which can be decreased to reduce these errors. More information on this issue can be found here: https://bugs.launchpad.net/nova/+bug/1007027 for more details. Change-Id: I6e9388b36207be87f7e706be18b4cd4060956a55
This commit is contained in:
@@ -20,6 +20,7 @@ class openstack::cinder::controller(
|
||||
$db_user = 'cinder',
|
||||
$db_host = '127.0.0.1',
|
||||
$db_dbname = 'cinder',
|
||||
$sql_idle_timeout = '3600',
|
||||
$package_ensure = present,
|
||||
$api_package_ensure = present,
|
||||
$scheduler_package_ensure = present,
|
||||
@@ -42,6 +43,7 @@ class openstack::cinder::controller(
|
||||
|
||||
class {'::cinder':
|
||||
sql_connection => $sql_connection,
|
||||
sql_idle_timeout => $sql_idle_timeout,
|
||||
rpc_backend => $rpc_backend,
|
||||
rabbit_userid => $rabbit_userid,
|
||||
rabbit_password => $rabbit_password,
|
||||
|
@@ -8,6 +8,8 @@
|
||||
# [private_interface] Interface used for vm networking connectivity. Required.
|
||||
# [internal_address] Internal address used for management. Required.
|
||||
# [mysql_root_password] Root password for mysql server.
|
||||
# [sql_idle_timeout] Timeout for sql to reap connections.
|
||||
# (Optional) Defaults to undef.
|
||||
# [admin_email] Admin email.
|
||||
# [admin_password] Admin password.
|
||||
# [keystone_db_password] Keystone database password.
|
||||
@@ -120,6 +122,7 @@ class openstack::controller (
|
||||
$mysql_root_password = 'sql_pass',
|
||||
$mysql_account_security = true,
|
||||
$mysql_bind_address = '0.0.0.0',
|
||||
$sql_idle_timeout = undef,
|
||||
$allowed_hosts = '%',
|
||||
# Keystone
|
||||
$keystone_host = '127.0.0.1',
|
||||
@@ -268,6 +271,7 @@ class openstack::controller (
|
||||
db_password => $keystone_db_password,
|
||||
db_name => $keystone_db_dbname,
|
||||
db_user => $keystone_db_user,
|
||||
idle_timeout => $sql_idle_timeout,
|
||||
admin_token => $keystone_admin_token,
|
||||
admin_tenant => $keystone_admin_tenant,
|
||||
admin_email => $admin_email,
|
||||
@@ -296,6 +300,7 @@ class openstack::controller (
|
||||
verbose => $verbose,
|
||||
db_type => $db_type,
|
||||
db_host => $db_host,
|
||||
sql_idle_timeout => $sql_idle_timeout,
|
||||
keystone_host => $keystone_host,
|
||||
db_user => $glance_db_user,
|
||||
db_name => $glance_db_dbname,
|
||||
@@ -321,6 +326,7 @@ class openstack::controller (
|
||||
class { 'openstack::nova::controller':
|
||||
# Database
|
||||
db_host => $db_host,
|
||||
sql_idle_timeout => $sql_idle_timeout,
|
||||
# Network
|
||||
network_manager => $network_manager,
|
||||
network_config => $network_config,
|
||||
@@ -380,6 +386,7 @@ class openstack::controller (
|
||||
class { 'openstack::quantum':
|
||||
# Database
|
||||
db_host => $db_host,
|
||||
sql_idle_timeout => $sql_idle_timeout,
|
||||
# Rabbit
|
||||
rabbit_host => $rabbit_host,
|
||||
rabbit_user => $rabbit_user,
|
||||
@@ -425,6 +432,7 @@ class openstack::controller (
|
||||
|
||||
class { 'openstack::cinder::controller':
|
||||
bind_host => $cinder_bind_address,
|
||||
sql_idle_timeout => $sql_idle_timeout,
|
||||
keystone_auth_host => $keystone_host,
|
||||
keystone_password => $cinder_user_password,
|
||||
rabbit_userid => $rabbit_user,
|
||||
|
@@ -17,6 +17,10 @@
|
||||
# quantum metadata services.
|
||||
# (Optional). Defaults to undef.
|
||||
#
|
||||
# [sql_idle_timeout]
|
||||
# Timeout for sql to reap connections.
|
||||
# (Optional) Defaults to '3600'.
|
||||
#
|
||||
# === Examples
|
||||
#
|
||||
# class { 'openstack::nova::controller':
|
||||
@@ -66,6 +70,7 @@ class openstack::nova::controller (
|
||||
$rabbit_virtual_host = '/',
|
||||
# Database
|
||||
$db_type = 'mysql',
|
||||
$sql_idle_timeout = '3600',
|
||||
# Glance
|
||||
$glance_api_servers = undef,
|
||||
# VNC
|
||||
@@ -114,6 +119,7 @@ class openstack::nova::controller (
|
||||
# Configure Nova
|
||||
class { 'nova':
|
||||
sql_connection => $sql_connection,
|
||||
sql_idle_timeout => $sql_idle_timeout,
|
||||
rabbit_userid => $rabbit_user,
|
||||
rabbit_password => $rabbit_password,
|
||||
rabbit_virtual_host => $rabbit_virtual_host,
|
||||
|
@@ -111,6 +111,10 @@
|
||||
# Address quantum api server should bind to.
|
||||
# (optional) Defaults to 0.0.0.0.
|
||||
#
|
||||
# [sql_idle_timeout]
|
||||
# Timeout for sql to reap connections.
|
||||
# (optional) Defaults to '3600'.
|
||||
#
|
||||
# [keystone_host]
|
||||
# Host running keystone.
|
||||
# (optional) Defaults to 127.0.0.1.
|
||||
@@ -172,6 +176,7 @@ class openstack::quantum (
|
||||
$db_host = '127.0.0.1',
|
||||
$db_name = 'quantum',
|
||||
$db_user = 'quantum',
|
||||
$sql_idle_timeout = '3600',
|
||||
# General
|
||||
$bind_address = '0.0.0.0',
|
||||
$keystone_host = '127.0.0.1',
|
||||
@@ -206,6 +211,7 @@ class openstack::quantum (
|
||||
}
|
||||
class { 'quantum::plugins::ovs':
|
||||
sql_connection => $sql_connection,
|
||||
sql_idle_timeout => $sql_idle_timeout,
|
||||
tenant_network_type => 'gre',
|
||||
}
|
||||
}
|
||||
|
@@ -17,6 +17,7 @@ describe 'openstack::cinder::controller' do
|
||||
it 'should configure using the default values' do
|
||||
should contain_class('cinder').with(
|
||||
:sql_connection => "mysql://cinder:#{params[:db_password]}@127.0.0.1/cinder?charset=utf8",
|
||||
:sql_idle_timeout => '3600',
|
||||
:rpc_backend => 'cinder.openstack.common.rpc.impl_kombu',
|
||||
:rabbit_userid => 'guest',
|
||||
:rabbit_password => params[:rabbit_password],
|
||||
|
@@ -318,6 +318,7 @@ describe 'openstack::controller' do
|
||||
:glance_user_password => 'glance_pass2',
|
||||
:glance_db_password => 'glance_pass3',
|
||||
:db_host => '127.0.0.2',
|
||||
:sql_idle_timeout => '30',
|
||||
:glance_db_user => 'dan',
|
||||
:glance_db_dbname => 'name',
|
||||
:db_host => '127.0.0.2'
|
||||
@@ -334,7 +335,8 @@ describe 'openstack::controller' do
|
||||
:keystone_tenant => 'services',
|
||||
:keystone_user => 'glance',
|
||||
:keystone_password => 'glance_pass2',
|
||||
:sql_connection => 'mysql://dan:glance_pass3@127.0.0.2/name'
|
||||
:sql_connection => 'mysql://dan:glance_pass3@127.0.0.2/name',
|
||||
:sql_idle_timeout => '30'
|
||||
)
|
||||
|
||||
should contain_class('glance::registry').with(
|
||||
@@ -425,9 +427,20 @@ describe 'openstack::controller' do
|
||||
should contain_class('nova::vncproxy').with(:enabled => false)
|
||||
end
|
||||
end
|
||||
context 'when params are overridden' do
|
||||
let :params do
|
||||
default_params.merge(
|
||||
:sql_idle_timeout => '30'
|
||||
)
|
||||
end
|
||||
it 'should override params for nova' do
|
||||
should contain_class('nova').with(
|
||||
:sql_idle_timeout => '30'
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
context 'config for horizon' do
|
||||
|
||||
it 'should contain enabled horizon' do
|
||||
@@ -488,16 +501,18 @@ describe 'openstack::controller' do
|
||||
:cinder_db_password => 'bar',
|
||||
:cinder_db_user => 'baz',
|
||||
:cinder_db_dbname => 'blah',
|
||||
:sql_idle_timeout => '30',
|
||||
:db_host => '127.0.0.2'
|
||||
)
|
||||
end
|
||||
it 'should configure cinder using defaults' do
|
||||
should contain_class('cinder').with(
|
||||
:debug => true,
|
||||
:verbose => true,
|
||||
:sql_connection => 'mysql://baz:bar@127.0.0.2/blah?charset=utf8',
|
||||
:rabbit_password => 'rabbit_pw2',
|
||||
:rabbit_userid => 'rabbituser'
|
||||
:debug => true,
|
||||
:verbose => true,
|
||||
:sql_connection => 'mysql://baz:bar@127.0.0.2/blah?charset=utf8',
|
||||
:sql_idle_timeout => '30',
|
||||
:rabbit_password => 'rabbit_pw2',
|
||||
:rabbit_userid => 'rabbituser'
|
||||
)
|
||||
should contain_class('cinder::api').with_keystone_password('foo')
|
||||
should contain_class('cinder::scheduler')
|
||||
@@ -515,6 +530,7 @@ describe 'openstack::controller' do
|
||||
:quantum => true,
|
||||
:debug => true,
|
||||
:verbose => true,
|
||||
:sql_idle_timeout => '30',
|
||||
:quantum_user_password => 'q_pass',
|
||||
:bridge_interface => 'eth_27',
|
||||
:internal_address => '10.0.0.3',
|
||||
@@ -529,6 +545,7 @@ describe 'openstack::controller' do
|
||||
|
||||
should contain_class('openstack::quantum').with(
|
||||
:db_host => '127.0.0.1',
|
||||
:sql_idle_timeout => '30',
|
||||
:rabbit_host => '127.0.0.1',
|
||||
:rabbit_user => 'openstack',
|
||||
:rabbit_password => 'rabbit_pw',
|
||||
|
Reference in New Issue
Block a user