From d1028879c485c652eecafe2ff42788d4955268b7 Mon Sep 17 00:00:00 2001 From: Derek Higgins Date: Fri, 26 Apr 2013 06:17:03 -0400 Subject: [PATCH] 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 --- manifests/api.pp | 16 +++++++++------- spec/classes/nova_api_spec.rb | 7 +++++++ spec/classes/nova_db_postgresql_spec.rb | 8 ++++---- 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/manifests/api.pp b/manifests/api.pp index a64f2540b..3b209f529 100644 --- a/manifests/api.pp +++ b/manifests/api.pp @@ -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 { diff --git a/spec/classes/nova_api_spec.rb b/spec/classes/nova_api_spec.rb index 31a008a7b..16400541b 100644 --- a/spec/classes/nova_api_spec.rb +++ b/spec/classes/nova_api_spec.rb @@ -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 diff --git a/spec/classes/nova_db_postgresql_spec.rb b/spec/classes/nova_db_postgresql_spec.rb index 3d8336802..714e9425f 100644 --- a/spec/classes/nova_db_postgresql_spec.rb +++ b/spec/classes/nova_db_postgresql_spec.rb @@ -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