Support more [agent] options

Improve coverage of [agent] options so that all options in the section
can be managed by the corresponding class.

Change-Id: Ie2b5a3b66bfabd8e0dfb61dcba0168bcd053b1ba
This commit is contained in:
Takashi Kajinami
2024-07-16 22:38:17 +09:00
parent f63900b549
commit 7f259ccc38
3 changed files with 129 additions and 15 deletions

View File

@@ -9,11 +9,20 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# Configure the IPA-related parameters in Ironic
#
# === Parameters
#
# [*manage_agent_boot*]
# (optional) Whether Ironic will managed booting of the agent ramdisk.
# Defaults to $facts['os_service_default']
#
# [*memory_consumed_by_agent*]
# (optional) The memory size in MIB consumed by agent when it is booted on
# a bare metal node.
# Defaults to $facts['os_service_default']
#
# [*stream_raw_images*]
# (optional) Whether to stream raw images directly on the hard drive instead
# of first caching them in memory. Ignored when iSCSI is used for deploy.
@@ -78,7 +87,47 @@
# commands completion.
# Defaults to $facts['os_service_default']
#
# [*neutron_agent_poll_interval*]
# (optional) The number of seconds Neutron agent will wait between polling
# for device changes.
# Defaults to $facts['os_service_default']
#
# [*neutron_agent_max_attempts*]
# (optional) Max number of attempts to validate a Neutron agent status before
# raising network error for a dead agent.
# Defaults to $facts['os_service_default']
#
# [*neutron_agent_status_retry_interval*]
# (optional) Wait time in seconds between attempts for validating Neutron
# agent status.
# Defaults to $facts['os_service_default']
#
# [*require_tls*]
# (optional) If set to False, callback URLs without https:// will be
# permitted by the conductor.
# Defaults to $facts['os_service_default']
#
# [*certificates_path*]
# (optional) Path to store auto-generated TLS certificates used to validate
# connections to the ramdisk.
# Defaults to $facts['os_service_default']
#
# [*verify_ca*]
# (optional) Path to the TLS CA to validate connection to the ramdisk.
# Defaults to $facts['os_service_default']
#
# [*api_ca_file*]
# (optional) Path to the TLS CA that is used to start the bare metal API.
# Defaults to $facts['os_service_default']
#
# [*allow_md5_checksum*]
# (optional) When enabled, the agent will be notified it is permitted to
# consider MD5 checksums.
# Defaults to $facts['os_service_default']
#
class ironic::drivers::agent (
$manage_agent_boot = $facts['os_service_default'],
$memory_consumed_by_agent = $facts['os_service_default'],
$stream_raw_images = $facts['os_service_default'],
$image_download_source = $facts['os_service_default'],
$post_deploy_get_power_state_retries = $facts['os_service_default'],
@@ -92,12 +141,22 @@ class ironic::drivers::agent (
$max_command_attempts = $facts['os_service_default'],
$command_wait_attempts = $facts['os_service_default'],
$command_wait_interval = $facts['os_service_default'],
$neutron_agent_poll_interval = $facts['os_service_default'],
$neutron_agent_max_attempts = $facts['os_service_default'],
$neutron_agent_status_retry_interval = $facts['os_service_default'],
$require_tls = $facts['os_service_default'],
$certificates_path = $facts['os_service_default'],
$verify_ca = $facts['os_service_default'],
$api_ca_file = $facts['os_service_default'],
$allow_md5_checksum = $facts['os_service_default'],
) {
include ironic::deps
# Configure ironic.conf
ironic_config {
'agent/manage_agent_boot': value => $manage_agent_boot;
'agent/memory_consumed_by_agent': value => $memory_consumed_by_agent;
'agent/stream_raw_images': value => $stream_raw_images;
'agent/image_download_source': value => $image_download_source;
'agent/post_deploy_get_power_state_retries': value => $post_deploy_get_power_state_retries;
@@ -111,6 +170,13 @@ class ironic::drivers::agent (
'agent/max_command_attempts': value => $max_command_attempts;
'agent/command_wait_attempts': value => $command_wait_attempts;
'agent/command_wait_interval': value => $command_wait_interval;
'agent/neutron_agent_poll_interval': value => $neutron_agent_poll_interval;
'agent/neutron_agent_max_attempts': value => $neutron_agent_max_attempts;
'agent/neutron_agent_status_retry_interval': value => $neutron_agent_status_retry_interval;
'agent/require_tls': value => $require_tls;
'agent/certificates_path': value => $certificates_path;
'agent/verify_ca': value => $verify_ca;
'agent/api_ca_file': value => $api_ca_file;
'agent/allow_md5_checksum': value => $allow_md5_checksum;
}
}

View File

@@ -0,0 +1,16 @@
---
features:
- |
The following parameters have been added to the ``ironic::drivers::agent``
class.
- ``manage_agent_boot``
- ``memory_consumed_by_agent``
- ``neutron_agent_poll_interval``
- ``neutron_agent_max_attempts``
- ``neutron_agent_status_retry_interval``
- ``require_tls``
- ``certificates_path``
- ``verify_ca``
- ``api_ca_file``
- ``allow_md5_checksum``

View File

@@ -27,6 +27,8 @@ describe 'ironic::drivers::agent' do
end
it 'configures ironic.conf' do
is_expected.to contain_ironic_config('agent/manage_agent_boot').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('agent/memory_consumed_by_agent').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('agent/stream_raw_images').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('agent/image_download_source').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('agent/post_deploy_get_power_state_retries').with_value('<SERVICE DEFAULT>')
@@ -40,25 +42,47 @@ describe 'ironic::drivers::agent' do
is_expected.to contain_ironic_config('agent/max_command_attempts').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('agent/command_wait_interval').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('agent/command_wait_attempts').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('agent/neutron_agent_poll_interval').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('agent/neutron_agent_max_attempts').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('agent/neutron_agent_status_retry_interval').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('agent/require_tls').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('agent/certificates_path').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('agent/verify_ca').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('agent/api_ca_file').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('agent/allow_md5_checksum').with_value('<SERVICE DEFAULT>')
end
context 'when overriding parameters' do
before do
params.merge!(:stream_raw_images => false,
:image_download_source => 'http',
:post_deploy_get_power_state_retries => 20,
:post_deploy_get_power_state_retry_interval => 10,
:deploy_logs_collect => 'always',
:deploy_logs_storage_backend => 'swift',
:deploy_logs_local_path => '/tmp',
:deploy_logs_swift_container => 'cont',
:deploy_logs_swift_days_to_expire => 5,
:command_timeout => 90,
:max_command_attempts => 5,
:command_wait_interval => 2,
:command_wait_attempts => 100)
params.merge!({
:manage_agent_boot => true,
:memory_consumed_by_agent => 0,
:stream_raw_images => false,
:image_download_source => 'http',
:post_deploy_get_power_state_retries => 20,
:post_deploy_get_power_state_retry_interval => 10,
:deploy_logs_collect => 'always',
:deploy_logs_storage_backend => 'swift',
:deploy_logs_local_path => '/tmp',
:deploy_logs_swift_container => 'cont',
:deploy_logs_swift_days_to_expire => 5,
:command_timeout => 90,
:max_command_attempts => 5,
:command_wait_interval => 2,
:command_wait_attempts => 100,
:neutron_agent_poll_interval => 3,
:neutron_agent_max_attempts => 110,
:neutron_agent_status_retry_interval => 10,
:require_tls => true,
:certificates_path => '/var/lib/ironic/certificates',
:verify_ca => true,
:api_ca_file => '/path/to/api/ca',
:allow_md5_checksum => true,
})
end
it 'should replace default parameter with new value' do
is_expected.to contain_ironic_config('agent/manage_agent_boot').with_value(p[:manage_agent_boot])
is_expected.to contain_ironic_config('agent/memory_consumed_by_agent').with_value(p[:memory_consumed_by_agent])
is_expected.to contain_ironic_config('agent/stream_raw_images').with_value(p[:stream_raw_images])
is_expected.to contain_ironic_config('agent/image_download_source').with_value(p[:image_download_source])
is_expected.to contain_ironic_config('agent/post_deploy_get_power_state_retries').with_value(p[:post_deploy_get_power_state_retries])
@@ -72,6 +96,14 @@ describe 'ironic::drivers::agent' do
is_expected.to contain_ironic_config('agent/max_command_attempts').with_value(p[:max_command_attempts])
is_expected.to contain_ironic_config('agent/command_wait_interval').with_value(p[:command_wait_interval])
is_expected.to contain_ironic_config('agent/command_wait_attempts').with_value(p[:command_wait_attempts])
is_expected.to contain_ironic_config('agent/neutron_agent_poll_interval').with_value(p[:neutron_agent_poll_interval])
is_expected.to contain_ironic_config('agent/neutron_agent_max_attempts').with_value(p[:neutron_agent_max_attempts])
is_expected.to contain_ironic_config('agent/neutron_agent_status_retry_interval').with_value(p[:neutron_agent_status_retry_interval])
is_expected.to contain_ironic_config('agent/require_tls').with_value(p[:require_tls])
is_expected.to contain_ironic_config('agent/certificates_path').with_value(p[:certificates_path])
is_expected.to contain_ironic_config('agent/verify_ca').with_value(p[:verify_ca])
is_expected.to contain_ironic_config('agent/api_ca_file').with_value(p[:api_ca_file])
is_expected.to contain_ironic_config('agent/allow_md5_checksum').with_value(p[:allow_md5_checksum])
end
end