From 1dcd3cd4eb13cf45ab7c148188329131f5fb388a Mon Sep 17 00:00:00 2001 From: Wei Hui Date: Tue, 20 Dec 2016 17:43:21 +0800 Subject: [PATCH] Add ironic driver's parameters to poll ironic-api Baremetal server's power on test time is usually very long, ironic driver's default values are not enough for some servers. Add those two parameter, so downstream project like fuel can have custom config. Change-Id: I9c74a322b0d9093a20cd54bc8787772b8a638dd1 --- manifests/ironic/common.pp | 42 ++++++++++++------- ...arameters-ironic-api-e4cbcc3c65291c3b.yaml | 5 +++ spec/classes/nova_ironic_common_spec.rb | 16 ++++--- 3 files changed, 42 insertions(+), 21 deletions(-) create mode 100644 releasenotes/notes/add-poll-parameters-ironic-api-e4cbcc3c65291c3b.yaml diff --git a/manifests/ironic/common.pp b/manifests/ironic/common.pp index 431318e5f..e3671a6aa 100644 --- a/manifests/ironic/common.pp +++ b/manifests/ironic/common.pp @@ -24,6 +24,12 @@ # The admin username for Ironic to connect to Nova. # Defaults to 'admin' # +# [*api_max_retries*] +# Max times for ironic driver to poll ironic api +# +# [*api_retry_interval*] +# Interval in second for ironic driver to poll ironic api +# # === DEPRECATED # # [*admin_username*] @@ -43,17 +49,19 @@ # Defaults to 'services' # class nova::ironic::common ( - $api_endpoint = 'http://127.0.0.1:6385/v1', - $auth_plugin = 'password', - $auth_url = 'http://127.0.0.1:35357/', - $password = 'ironic', - $project_name = 'services', - $username = 'admin', + $api_endpoint = 'http://127.0.0.1:6385/v1', + $auth_plugin = 'password', + $auth_url = 'http://127.0.0.1:35357/', + $password = 'ironic', + $project_name = 'services', + $username = 'admin', + $api_max_retries = $::os_service_default, + $api_retry_interval = $::os_service_default, # DEPRECATED - $admin_username = undef, - $admin_password = undef, - $admin_tenant_name = undef, - $admin_url = undef, + $admin_username = undef, + $admin_password = undef, + $admin_tenant_name = undef, + $admin_url = undef, ) { include ::nova::deps @@ -83,12 +91,14 @@ class nova::ironic::common ( nova_config { - 'ironic/auth_plugin': value => $auth_plugin; - 'ironic/username': value => $username_real; - 'ironic/password': value => $password_real; - 'ironic/auth_url': value => $auth_url_real; - 'ironic/project_name': value => $project_name_real; - 'ironic/api_endpoint': value => $api_endpoint; + 'ironic/auth_plugin': value => $auth_plugin; + 'ironic/username': value => $username_real; + 'ironic/password': value => $password_real; + 'ironic/auth_url': value => $auth_url_real; + 'ironic/project_name': value => $project_name_real; + 'ironic/api_endpoint': value => $api_endpoint; + 'ironic/api_max_retries': value => $api_max_retries; + 'ironic/api_retry_interval': value => $api_retry_interval; } # TODO(aschultz): these are deprecated, remove in P diff --git a/releasenotes/notes/add-poll-parameters-ironic-api-e4cbcc3c65291c3b.yaml b/releasenotes/notes/add-poll-parameters-ironic-api-e4cbcc3c65291c3b.yaml new file mode 100644 index 000000000..8037ec1c2 --- /dev/null +++ b/releasenotes/notes/add-poll-parameters-ironic-api-e4cbcc3c65291c3b.yaml @@ -0,0 +1,5 @@ +--- +features: + - Adds the api_max_retries and api_retry_interval config + parameters for nova ironic driver to poll ironic api. + If not specify explicitly, use service's default value. diff --git a/spec/classes/nova_ironic_common_spec.rb b/spec/classes/nova_ironic_common_spec.rb index 1edc63e83..4462a76df 100644 --- a/spec/classes/nova_ironic_common_spec.rb +++ b/spec/classes/nova_ironic_common_spec.rb @@ -12,6 +12,8 @@ describe 'nova::ironic::common' do is_expected.to contain_nova_config('ironic/auth_url').with_value('http://127.0.0.1:35357/') is_expected.to contain_nova_config('ironic/project_name').with_value('services') is_expected.to contain_nova_config('ironic/api_endpoint').with_value('http://127.0.0.1:6385/v1') + is_expected.to contain_nova_config('ironic/api_max_retries').with('value' => '') + is_expected.to contain_nova_config('ironic/api_retry_interval').with('value' => '') is_expected.to contain_nova_config('ironic/admin_username').with_value('admin') is_expected.to contain_nova_config('ironic/admin_password').with_value('ironic') @@ -23,11 +25,13 @@ describe 'nova::ironic::common' do context 'with parameters' do let :params do { - :username => 'ironic', - :password => 's3cr3t', - :auth_url => 'http://10.0.0.10:35357/', - :project_name => 'services2', - :api_endpoint => 'http://10.0.0.10:6385/v1', + :username => 'ironic', + :password => 's3cr3t', + :auth_url => 'http://10.0.0.10:35357/', + :project_name => 'services2', + :api_endpoint => 'http://10.0.0.10:6385/v1', + :api_max_retries => 60, + :api_retry_interval => 2, } end @@ -38,6 +42,8 @@ describe 'nova::ironic::common' do is_expected.to contain_nova_config('ironic/auth_url').with_value('http://10.0.0.10:35357/') is_expected.to contain_nova_config('ironic/project_name').with_value('services2') is_expected.to contain_nova_config('ironic/api_endpoint').with_value('http://10.0.0.10:6385/v1') + is_expected.to contain_nova_config('ironic/api_max_retries').with('value' => '60') + is_expected.to contain_nova_config('ironic/api_retry_interval').with('value' => '2') is_expected.to contain_nova_config('ironic/admin_username').with_value('ironic') is_expected.to contain_nova_config('ironic/admin_password').with_value('s3cr3t')