Allow user to set the number of api workers

Defaults to ::processorcount
Also reseting puppet 2.6 compat in spec/classes/nova_db_postgresql_spec.rb
so that unit tests pass, it looks like our 2.6 unit test runner is using
puppet 2.7

Change-Id: I521679ce497a6d9f39a88a6e1d16d5a4ca67255a
This commit is contained in:
Derek Higgins
2013-04-26 06:17:03 -04:00
parent 2c9c006e43
commit d1028879c4
3 changed files with 20 additions and 11 deletions

View File

@@ -25,6 +25,7 @@ class nova::api(
$api_bind_address = '0.0.0.0',
$enabled_apis = 'ec2,osapi_compute,metadata',
$volume_api_class = 'nova.volume.cinder.API',
$workers = $::processorcount,
$sync_db = true
) {
@@ -50,13 +51,14 @@ class nova::api(
}
nova_config {
'DEFAULT/api_paste_config': value => '/etc/nova/api-paste.ini';
'DEFAULT/enabled_apis': value => $enabled_apis;
'DEFAULT/volume_api_class': value => $volume_api_class;
'DEFAULT/ec2_listen': value => $api_bind_address;
'DEFAULT/osapi_compute_listen': value => $api_bind_address;
'DEFAULT/metadata_listen': value => $api_bind_address;
'DEFAULT/osapi_volume_listen': value => $api_bind_address;
'DEFAULT/api_paste_config': value => '/etc/nova/api-paste.ini';
'DEFAULT/enabled_apis': value => $enabled_apis;
'DEFAULT/volume_api_class': value => $volume_api_class;
'DEFAULT/ec2_listen': value => $api_bind_address;
'DEFAULT/osapi_compute_listen': value => $api_bind_address;
'DEFAULT/metadata_listen': value => $api_bind_address;
'DEFAULT/osapi_volume_listen': value => $api_bind_address;
'DEFAULT/osapi_compute_workers': value => $workers;
}
nova_paste_api_ini {

View File

@@ -65,6 +65,12 @@ describe 'nova::api' do
it { should contain_nova_config('DEFAULT/osapi_volume_listen').with('value' => '0.0.0.0') }
end
describe 'with params' do
let :facts do
{
:osfamily => 'RedHat',
:processorcount => 5
}
end
let :params do
{
:auth_strategy => 'foo',
@@ -96,6 +102,7 @@ describe 'nova::api' do
it { should contain_nova_config('DEFAULT/osapi_compute_listen').with('value' => '192.168.56.210') }
it { should contain_nova_config('DEFAULT/metadata_listen').with('value' => '192.168.56.210') }
it { should contain_nova_config('DEFAULT/osapi_volume_listen').with('value' => '192.168.56.210') }
it { should contain_nova_config('DEFAULT/osapi_compute_workers').with('value' => '5') }
end
end
describe 'on rhel' do

View File

@@ -9,7 +9,7 @@ describe 'nova::db::postgresql' do
let :facts do
{
:postgres_default_version => '8.4',
:osfamily => 'RedHat',
:osfamily => 'RedHat'
}
end
@@ -20,7 +20,7 @@ describe 'nova::db::postgresql' do
it { should contain_postgresql__db('nova').with(
:user => 'nova',
:password => 'qwerty',
:password => 'qwerty'
)}
end
@@ -30,7 +30,7 @@ describe 'nova::db::postgresql' do
let :facts do
{
:postgres_default_version => '8.4',
:osfamily => 'Debian',
:osfamily => 'Debian'
}
end
@@ -41,7 +41,7 @@ describe 'nova::db::postgresql' do
it { should contain_postgresql__db('nova').with(
:user => 'nova',
:password => 'qwerty',
:password => 'qwerty'
)}
end