Configure parameters for managed in-band inspection

Change-Id: I4ddbba19f48d7f6643dab71097d2018b4a9757d3
Depends-On: https://review.opendev.org/688720
Story: #1528920
This commit is contained in:
Dmitry Tantsur 2019-11-05 13:17:13 +01:00
parent 6deffc3188
commit b7f0988c0c
5 changed files with 90 additions and 25 deletions

View File

@ -92,6 +92,12 @@
# for rescue. Can not be specified together with rescuing_network_name.
# Defaults to $::os_service_default
#
# [*inspection_network*]
# (optional) Neutron network UUID or name for the ramdisk to be booted into
# for in-band inspection. Can not be specified together with
# inspection_network_name.
# Defaults to $::os_service_default
#
# [*configdrive_use_swift*]
# (optional) Whether to use Swift for storing config drives instead of
# the database. Recommended for bigger config drives.
@ -136,6 +142,12 @@
# Can not be specified together with rescuing_network.
# Defaults to undef, which leaves the configuration intact
#
# [*inspection_network_name*]
# (optional) If provided the name will be converted to UUID and set
# as value of neutron/inspection_network option in ironic.conf
# Can not be specified together with inspection_network.
# Defaults to undef, which leaves the configuration intact
#
# [*port_setup_delay*]
# (optional) Delay value to wait for Neutron agents to setup
# sufficient DHCP configuration for port.
@ -206,6 +218,7 @@ class ironic::conductor (
$api_url = $::os_service_default,
$provisioning_network = $::os_service_default,
$rescuing_network = $::os_service_default,
$inspection_network = $::os_service_default,
$configdrive_use_swift = $::os_service_default,
$configdrive_swift_container = $::os_service_default,
$inspect_timeout = $::os_service_default,
@ -215,6 +228,7 @@ class ironic::conductor (
$cleaning_network_name = undef,
$provisioning_network_name = undef,
$rescuing_network_name = undef,
$inspection_network_name = undef,
$power_state_change_timeout = $::os_service_default,
$sync_power_state_interval = $::os_service_default,
$power_state_sync_max_retries = $::os_service_default,
@ -245,6 +259,10 @@ class ironic::conductor (
fail('rescuing_network_name and rescuing_network can not be specified in the same time.')
}
if ($inspection_network_name and !is_service_default($inspection_network)) {
fail('inspection_network_name and inspection_network can not be specified in the same time.')
}
validate_legacy(Array, 'validate_array', $enabled_hardware_types)
# NOTE(dtantsur): all in-tree drivers are IPA-based, so it won't hurt
@ -347,6 +365,16 @@ class ironic::conductor (
}
}
if $inspection_network_name {
ironic_config {
'neutron/inspection_network': value => $inspection_network_name, transform_to => 'net_uuid';
}
} else {
ironic_config {
'neutron/inspection_network': value => $inspection_network;
}
}
# Install package
if $::ironic::params::conductor_package {
package { 'ironic-conductor':

View File

@ -46,6 +46,18 @@
# The endpoint URL for requests for this client
# Defaults to $::os_service_default
#
# [*callback_endpoint_override*]
# The endpoint URL to use for ramdisk callback in case of managed boot.
# Defaults to $::os_service_default
#
# [*power_off*]
# Whether to power off a node after inspection in case of managed boot.
# Defaults to $::os_service_default
#
# [*extra_kernel_params*]
# Extra kernel parameters to pass in case of managed boot.
# Defaults to $::os_service_default
#
# DEPRECATED PARAMETERS
#
# [*service_url*]
@ -61,6 +73,9 @@ class ironic::drivers::inspector (
$user_domain_name = 'Default',
$project_domain_name = 'Default',
$endpoint_override = $::os_service_default,
$callback_endpoint_override = $::os_service_default,
$power_off = $::os_service_default,
$extra_kernel_params = $::os_service_default,
# DEPRECATED PARAMETERS
$service_url = undef,
) {
@ -81,5 +96,8 @@ has no effect. Please use ironic::drivers::inspector::endpoint_override instead.
'inspector/user_domain_name': value => $user_domain_name;
'inspector/project_domain_name': value => $project_domain_name;
'inspector/endpoint_override': value => $endpoint_override;
'inspector/callback_endpoint_override': value => $callback_endpoint_override;
'inspector/power_off': value => $power_off;
'inspector/extra_kernel_params': value => $extra_kernel_params;
}
}

View File

@ -0,0 +1,8 @@
---
features:
- |
Allows configuring ``callback_endpoint_override``, ``power_off`` and
``extra_kernel_params`` in ``ironic::drivers::inspector``.
- |
Allows setting ``inspection_network`` (or ``inspection_network_name``)
in ``ironic::conductor``.

View File

@ -70,6 +70,7 @@ describe 'ironic::conductor' do
is_expected.to contain_ironic_config('neutron/cleaning_network').with(:value => '<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('neutron/provisioning_network').with(:value => '<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('neutron/rescuing_network').with(:value => '<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('neutron/inspection_network').with(:value => '<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('deploy/continue_if_disk_secure_erase_fails').with(:value => '<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('deploy/http_url').with(:value => '<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('deploy/http_root').with(:value => '<SERVICE DEFAULT>')
@ -98,6 +99,7 @@ describe 'ironic::conductor' do
:api_url => 'https://127.0.0.1:6385',
:provisioning_network => '00000000-0000-0000-0000-000000000000',
:rescuing_network => '00000000-0000-0000-0000-000000000000',
:inspection_network => '00000000-0000-0000-0000-000000000000',
:cleaning_disk_erase => 'metadata',
:http_url => 'http://host:port',
:http_root => '/src/www',
@ -129,6 +131,7 @@ describe 'ironic::conductor' do
is_expected.to contain_ironic_config('neutron/cleaning_network').with_value('00000000-0000-0000-0000-000000000000')
is_expected.to contain_ironic_config('neutron/provisioning_network').with_value('00000000-0000-0000-0000-000000000000')
is_expected.to contain_ironic_config('neutron/rescuing_network').with_value('00000000-0000-0000-0000-000000000000')
is_expected.to contain_ironic_config('neutron/inspection_network').with_value('00000000-0000-0000-0000-000000000000')
is_expected.to contain_ironic_config('deploy/erase_devices_priority').with_value(0)
is_expected.to contain_ironic_config('deploy/erase_devices_metadata_priority').with_value(10)
is_expected.to contain_ironic_config('deploy/http_url').with_value(p[:http_url])
@ -159,12 +162,14 @@ describe 'ironic::conductor' do
:provisioning_network_name => 'abc',
:cleaning_network_name => 'abc',
:rescuing_network_name => 'abc',
:inspection_network_name => 'abc',
)
end
it 'should set provisioning/cleaning/rescuing with new value' do
is_expected.to contain_ironic_config('neutron/cleaning_network').with_value('abc').with_transform_to('net_uuid')
is_expected.to contain_ironic_config('neutron/provisioning_network').with_value('abc').with_transform_to('net_uuid')
is_expected.to contain_ironic_config('neutron/rescuing_network').with_value('abc').with_transform_to('net_uuid')
is_expected.to contain_ironic_config('neutron/inspection_network').with_value('abc').with_transform_to('net_uuid')
end
end

View File

@ -55,6 +55,9 @@ describe 'ironic::drivers::inspector' do
:user_domain_name => 'NonDefault',
:project_domain_name => 'NonDefault',
:endpoint_override => 'http://example2.com',
:callback_endpoint_override => 'http://10.0.0.1/v1/continue',
:power_off => false,
:extra_kernel_params => 'ipa-inspection-collectors=a,b,c',
)
end
@ -67,6 +70,9 @@ describe 'ironic::drivers::inspector' do
is_expected.to contain_ironic_config('inspector/user_domain_name').with_value(p[:user_domain_name])
is_expected.to contain_ironic_config('inspector/project_domain_name').with_value(p[:project_domain_name])
is_expected.to contain_ironic_config('inspector/endpoint_override').with_value(p[:endpoint_override])
is_expected.to contain_ironic_config('inspector/callback_endpoint_override').with_value(p[:callback_endpoint_override])
is_expected.to contain_ironic_config('inspector/power_off').with_value(p[:power_off])
is_expected.to contain_ironic_config('inspector/extra_kernel_params').with_value(p[:extra_kernel_params])
end
end