Set up db parameters for Sahara

Specify db parameters for Sahara to avoid occasional errors during
cluster spawning.

Change-Id: Ib62dea8654878af2645f08508918bb877f8e6e15
Closes-bug: #1497365
This commit is contained in:
Denis Egorenko 2015-10-12 16:56:17 +03:00
parent b51352e67a
commit 6abfa10145
2 changed files with 59 additions and 42 deletions

View File

@ -43,6 +43,10 @@ if $sahara_hash['enabled'] {
$db_name = pick($sahara_hash['db_name'], 'sahara')
$db_password = pick($sahara_hash['db_password'])
$db_host = pick($sahara_hash['db_host'], $database_vip)
$max_pool_size = min($::processorcount * 5 + 0, 30 + 0)
$max_overflow = min($::processorcount * 5 + 0, 60 + 0)
$max_retries = '-1'
$idle_timeout = '3600'
$read_timeout = '60'
$sql_connection = "mysql://${db_user}:${db_password}@${db_host}/${db_name}?read_timeout=${read_timeout}"
@ -58,27 +62,31 @@ if $sahara_hash['enabled'] {
}
class { 'sahara' :
host => $api_bind_host,
port => $api_bind_port,
verbose => $verbose,
debug => $debug,
use_syslog => $use_syslog,
use_stderr => $use_stderr,
plugins => [ 'ambari', 'cdh', 'mapr', 'spark', 'vanilla' ],
log_facility => $syslog_log_facility_sahara,
database_connection => $sql_connection,
auth_uri => "http://${service_endpoint}:5000/v2.0/",
identity_uri => "http://${service_endpoint}:35357/",
rpc_backend => 'rabbit',
use_neutron => $use_neutron,
admin_user => $sahara_user,
admin_password => $sahara_password,
admin_tenant_name => $tenant,
rabbit_userid => $rabbit_hash['user'],
rabbit_password => $rabbit_hash['password'],
rabbit_ha_queues => $rabbit_ha_queues,
rabbit_port => $amqp_port,
rabbit_hosts => split($amqp_hosts, ',')
host => $api_bind_host,
port => $api_bind_port,
verbose => $verbose,
debug => $debug,
use_syslog => $use_syslog,
use_stderr => $use_stderr,
plugins => [ 'ambari', 'cdh', 'mapr', 'spark', 'vanilla' ],
log_facility => $syslog_log_facility_sahara,
database_connection => $sql_connection,
database_max_pool_size => $max_pool_size,
database_max_overflow => $max_overflow,
database_max_retries => $max_retries,
database_idle_timeout => $idle_timeout,
auth_uri => "http://${service_endpoint}:5000/v2.0/",
identity_uri => "http://${service_endpoint}:35357/",
rpc_backend => 'rabbit',
use_neutron => $use_neutron,
admin_user => $sahara_user,
admin_password => $sahara_password,
admin_tenant_name => $tenant,
rabbit_userid => $rabbit_hash['user'],
rabbit_password => $rabbit_hash['password'],
rabbit_ha_queues => $rabbit_ha_queues,
rabbit_port => $amqp_port,
rabbit_hosts => split($amqp_hosts, ',')
}
if $public_ssl_hash['services'] {

View File

@ -53,6 +53,7 @@ describe manifest do
enable = Noop.hiera_structure('sahara/enabled')
context 'if sahara is enabled', :if => enable do
it 'should declare sahara class correctly' do
facts[:processorcount] = 10
sahara_plugins = %w(ambari cdh mapr spark vanilla)
sahara_user = Noop.hiera_structure('sahara_hash/user', 'sahara')
sahara_password = Noop.hiera_structure('sahara_hash/user_password')
@ -61,31 +62,39 @@ describe manifest do
db_name = Noop.hiera_structure('sahara_hash/db_name', 'sahara')
db_password = Noop.hiera_structure('sahara_hash/db_password')
db_host = Noop.hiera_structure('sahara_hash/db_host', database_vip)
max_pool_size =[facts[:processorcount] * 5 + 0, 30 + 0].min
max_overflow = [facts[:processorcount] * 5 + 0, 60 + 0].min
max_retries = '-1'
idle_timeout = '3600'
read_timeout = '60'
sql_connection = "mysql://#{db_user}:#{db_password}@#{db_host}/#{db_name}?read_timeout=#{read_timeout}"
should contain_class('sahara').with(
'auth_uri' => "http://#{service_endpoint}:5000/v2.0/",
'identity_uri' => "http://#{service_endpoint}:35357/",
'plugins' => sahara_plugins,
'rpc_backend' => 'rabbit',
'use_neutron' => use_neutron,
'admin_user' => sahara_user,
'verbose' => verbose,
'debug' => debug,
'use_syslog' => use_syslog,
'use_stderr' => 'false',
'log_facility' => log_facility_sahara,
'database_connection' => sql_connection,
'admin_password' => sahara_password,
'admin_tenant_name' => tenant,
'rabbit_userid' => rabbit_user,
'rabbit_password' => rabbit_password,
'rabbit_ha_queues' => rabbit_ha_queues,
'rabbit_port' => amqp_port,
'rabbit_hosts' => amqp_hosts.split(","),
'host' => bind_address,
'port' => '8386'
'auth_uri' => "http://#{service_endpoint}:5000/v2.0/",
'identity_uri' => "http://#{service_endpoint}:35357/",
'plugins' => sahara_plugins,
'rpc_backend' => 'rabbit',
'use_neutron' => use_neutron,
'admin_user' => sahara_user,
'verbose' => verbose,
'debug' => debug,
'use_syslog' => use_syslog,
'use_stderr' => 'false',
'log_facility' => log_facility_sahara,
'database_connection' => sql_connection,
'database_max_pool_size' => max_pool_size,
'database_max_overflow' => max_overflow,
'database_max_retries' => max_retries,
'database_idle_timeout' => idle_timeout,
'admin_password' => sahara_password,
'admin_tenant_name' => tenant,
'rabbit_userid' => rabbit_user,
'rabbit_password' => rabbit_password,
'rabbit_ha_queues' => rabbit_ha_queues,
'rabbit_port' => amqp_port,
'rabbit_hosts' => amqp_hosts.split(","),
'host' => bind_address,
'port' => '8386'
)
end