agent: support command_timeout and max_command_attempts

Change-Id: I84ccad43bf9d70152f6013550d70c5d7cbcee861
(cherry picked from commit d934b6bcca)
This commit is contained in:
Dmitry Tantsur 2020-04-24 13:46:07 +02:00
parent fc46d2aaa5
commit ee3cb9f356
3 changed files with 24 additions and 1 deletions

View File

@ -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;
}
}

View File

@ -0,0 +1,5 @@
---
features:
- |
Supports configuring ``max_command_attempts`` and ``command_timeout``
in ``ironic::drivers::agent``.

View File

@ -36,6 +36,8 @@ describe 'ironic::drivers::agent' do
is_expected.to contain_ironic_config('agent/deploy_logs_local_path').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('agent/deploy_logs_swift_container').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('agent/deploy_logs_swift_days_to_expire').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('agent/command_timeout').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('agent/max_command_attempts').with_value('<SERVICE DEFAULT>')
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