Add support for SQL idle timeout.
Previously, nova 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: I1b0e2c763b3e5c9d3310bfd36ec0f54189e4996d
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
# ==Parameters
|
||||
#
|
||||
# [sql_connection] Connection url to use to connect to nova sql database.
|
||||
# [sql_idle_timeout] Timeout before idle sql connections are reaped.
|
||||
# [image_service] Service used to search for and retrieve images. Optional.
|
||||
# Defaults to 'nova.image.local.LocalImageService'
|
||||
# [glance_api_servers] List of addresses for api servers. Optional.
|
||||
@@ -33,6 +34,7 @@ class nova(
|
||||
# this is how to query all resources from our clutser
|
||||
$nova_cluster_id='localcluster',
|
||||
$sql_connection = false,
|
||||
$sql_idle_timeout = '3600',
|
||||
$rpc_backend = 'nova.openstack.common.rpc.impl_kombu',
|
||||
$image_service = 'nova.image.glance.GlanceImageService',
|
||||
# these glance params should be optional
|
||||
@@ -153,7 +155,8 @@ class nova(
|
||||
fail("Invalid db connection ${sql_connection}")
|
||||
}
|
||||
nova_config {
|
||||
'DEFAULT/sql_connection': value => $sql_connection, secret => true,
|
||||
'DEFAULT/sql_connection': value => $sql_connection, secret => true;
|
||||
'DEFAULT/sql_idle_timeout': value => $sql_idle_timeout;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -55,6 +55,7 @@ describe 'nova' do
|
||||
)}
|
||||
|
||||
it { should_not contain_nova_config('DEFAULT/sql_connection') }
|
||||
it { should_not contain_nova_config('DEFAULT/sql_idle_timeout').with_value('3600') }
|
||||
|
||||
it { should contain_nova_config('DEFAULT/image_service').with_value('nova.image.glance.GlanceImageService') }
|
||||
it { should contain_nova_config('DEFAULT/glance_api_servers').with_value('localhost:9292') }
|
||||
@@ -86,6 +87,7 @@ describe 'nova' do
|
||||
let :params do
|
||||
{
|
||||
'sql_connection' => 'mysql://user:pass@db/db',
|
||||
'sql_idle_timeout' => '30',
|
||||
'verbose' => true,
|
||||
'debug' => true,
|
||||
'logdir' => '/var/log/nova2',
|
||||
@@ -106,6 +108,7 @@ describe 'nova' do
|
||||
it { should contain_package('nova-common').with('ensure' => '2012.1.1-15.el6') }
|
||||
it { should contain_package('python-nova').with('ensure' => '2012.1.1-15.el6') }
|
||||
it { should contain_nova_config('DEFAULT/sql_connection').with_value('mysql://user:pass@db/db').with_secret(true) }
|
||||
it { should contain_nova_config('DEFAULT/sql_idle_timeout').with_value('30') }
|
||||
|
||||
it { should contain_nova_config('DEFAULT/image_service').with_value('nova.image.local.LocalImageService') }
|
||||
it { should_not contain_nova_config('DEFAULT/glance_api_servers') }
|
||||
@@ -152,6 +155,7 @@ describe 'nova' do
|
||||
let :params do
|
||||
{
|
||||
'sql_connection' => 'mysql://user:pass@db/db',
|
||||
'sql_idle_timeout' => '30',
|
||||
'verbose' => true,
|
||||
'debug' => true,
|
||||
'logdir' => '/var/log/nova2',
|
||||
@@ -168,6 +172,7 @@ describe 'nova' do
|
||||
it { should contain_package('nova-common').with('ensure' => '2012.1.1-15.el6') }
|
||||
it { should contain_package('python-nova').with('ensure' => '2012.1.1-15.el6') }
|
||||
it { should contain_nova_config('DEFAULT/sql_connection').with_value('mysql://user:pass@db/db') }
|
||||
it { should contain_nova_config('DEFAULT/sql_idle_timeout').with_value('30') }
|
||||
|
||||
it { should contain_nova_config('DEFAULT/image_service').with_value('nova.image.local.LocalImageService') }
|
||||
it { should_not contain_nova_config('DEFAULT/glance_api_servers') }
|
||||
|
Reference in New Issue
Block a user