From ee3cb9f35640de0842c752d9820d38ee9e17e340 Mon Sep 17 00:00:00 2001 From: Dmitry Tantsur Date: Fri, 24 Apr 2020 13:46:07 +0200 Subject: [PATCH] agent: support command_timeout and max_command_attempts Change-Id: I84ccad43bf9d70152f6013550d70c5d7cbcee861 (cherry picked from commit d934b6bccaa3bdbe2d4eb0c0e5e3e5d201c3df2b) --- manifests/drivers/agent.pp | 12 ++++++++++++ .../notes/agent-retries-5c55bab92d8d8f9e.yaml | 5 +++++ spec/classes/ironic_drivers_agent_spec.rb | 8 +++++++- 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/agent-retries-5c55bab92d8d8f9e.yaml diff --git a/manifests/drivers/agent.pp b/manifests/drivers/agent.pp index f6a5ad86..0b2600c3 100644 --- a/manifests/drivers/agent.pp +++ b/manifests/drivers/agent.pp @@ -60,6 +60,14 @@ # (optional) Number of days before IPA logs expire in Swift. # Defaults to $::os_service_default # +# [*command_timeout*] +# (optional) Timeout in seconds to wait for a response from the agent. +# Defaults to $::os_service_default +# +# [*max_command_attempts*] +# (optional) Number of times to try connecting to the agent for a command. +# Defaults to $::os_service_default +# class ironic::drivers::agent ( $stream_raw_images = $::os_service_default, @@ -71,6 +79,8 @@ class ironic::drivers::agent ( $deploy_logs_local_path = $::os_service_default, $deploy_logs_swift_container = $::os_service_default, $deploy_logs_swift_days_to_expire = $::os_service_default, + $command_timeout = $::os_service_default, + $max_command_attempts = $::os_service_default, ) { include ::ironic::deps @@ -86,6 +96,8 @@ class ironic::drivers::agent ( 'agent/deploy_logs_local_path': value => $deploy_logs_local_path; 'agent/deploy_logs_swift_container': value => $deploy_logs_swift_container; 'agent/deploy_logs_swift_days_to_expire': value => $deploy_logs_swift_days_to_expire; + 'agent/command_timeout': value => $command_timeout; + 'agent/max_command_attempts': value => $max_command_attempts; } } diff --git a/releasenotes/notes/agent-retries-5c55bab92d8d8f9e.yaml b/releasenotes/notes/agent-retries-5c55bab92d8d8f9e.yaml new file mode 100644 index 00000000..e4762340 --- /dev/null +++ b/releasenotes/notes/agent-retries-5c55bab92d8d8f9e.yaml @@ -0,0 +1,5 @@ +--- +features: + - | + Supports configuring ``max_command_attempts`` and ``command_timeout`` + in ``ironic::drivers::agent``. diff --git a/spec/classes/ironic_drivers_agent_spec.rb b/spec/classes/ironic_drivers_agent_spec.rb index 4f0ae8ff..ca11e55d 100644 --- a/spec/classes/ironic_drivers_agent_spec.rb +++ b/spec/classes/ironic_drivers_agent_spec.rb @@ -36,6 +36,8 @@ describe 'ironic::drivers::agent' do is_expected.to contain_ironic_config('agent/deploy_logs_local_path').with_value('') is_expected.to contain_ironic_config('agent/deploy_logs_swift_container').with_value('') is_expected.to contain_ironic_config('agent/deploy_logs_swift_days_to_expire').with_value('') + is_expected.to contain_ironic_config('agent/command_timeout').with_value('') + is_expected.to contain_ironic_config('agent/max_command_attempts').with_value('') end context 'when overriding parameters' do @@ -48,7 +50,9 @@ describe 'ironic::drivers::agent' do :deploy_logs_storage_backend => 'swift', :deploy_logs_local_path => '/tmp', :deploy_logs_swift_container => 'cont', - :deploy_logs_swift_days_to_expire => 5) + :deploy_logs_swift_days_to_expire => 5, + :command_timeout => 90, + :max_command_attempts => 5) end it 'should replace default parameter with new value' do is_expected.to contain_ironic_config('agent/stream_raw_images').with_value(p[:stream_raw_images]) @@ -60,6 +64,8 @@ describe 'ironic::drivers::agent' do is_expected.to contain_ironic_config('agent/deploy_logs_local_path').with_value(p[:deploy_logs_local_path]) is_expected.to contain_ironic_config('agent/deploy_logs_swift_container').with_value(p[:deploy_logs_swift_container]) is_expected.to contain_ironic_config('agent/deploy_logs_swift_days_to_expire').with_value(p[:deploy_logs_swift_days_to_expire]) + is_expected.to contain_ironic_config('agent/command_timeout').with_value(p[:command_timeout]) + is_expected.to contain_ironic_config('agent/max_command_attempts').with_value(p[:max_command_attempts]) end end