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. # for rescue. Can not be specified together with rescuing_network_name.
# Defaults to $::os_service_default # 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*] # [*configdrive_use_swift*]
# (optional) Whether to use Swift for storing config drives instead of # (optional) Whether to use Swift for storing config drives instead of
# the database. Recommended for bigger config drives. # the database. Recommended for bigger config drives.
@@ -136,6 +142,12 @@
# Can not be specified together with rescuing_network. # Can not be specified together with rescuing_network.
# Defaults to undef, which leaves the configuration intact # 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*] # [*port_setup_delay*]
# (optional) Delay value to wait for Neutron agents to setup # (optional) Delay value to wait for Neutron agents to setup
# sufficient DHCP configuration for port. # sufficient DHCP configuration for port.
@@ -206,6 +218,7 @@ class ironic::conductor (
$api_url = $::os_service_default, $api_url = $::os_service_default,
$provisioning_network = $::os_service_default, $provisioning_network = $::os_service_default,
$rescuing_network = $::os_service_default, $rescuing_network = $::os_service_default,
$inspection_network = $::os_service_default,
$configdrive_use_swift = $::os_service_default, $configdrive_use_swift = $::os_service_default,
$configdrive_swift_container = $::os_service_default, $configdrive_swift_container = $::os_service_default,
$inspect_timeout = $::os_service_default, $inspect_timeout = $::os_service_default,
@@ -215,6 +228,7 @@ class ironic::conductor (
$cleaning_network_name = undef, $cleaning_network_name = undef,
$provisioning_network_name = undef, $provisioning_network_name = undef,
$rescuing_network_name = undef, $rescuing_network_name = undef,
$inspection_network_name = undef,
$power_state_change_timeout = $::os_service_default, $power_state_change_timeout = $::os_service_default,
$sync_power_state_interval = $::os_service_default, $sync_power_state_interval = $::os_service_default,
$power_state_sync_max_retries = $::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.') 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) validate_legacy(Array, 'validate_array', $enabled_hardware_types)
# NOTE(dtantsur): all in-tree drivers are IPA-based, so it won't hurt # 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 # Install package
if $::ironic::params::conductor_package { if $::ironic::params::conductor_package {
package { 'ironic-conductor': package { 'ironic-conductor':

View File

@@ -46,6 +46,18 @@
# The endpoint URL for requests for this client # The endpoint URL for requests for this client
# Defaults to $::os_service_default # 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 # DEPRECATED PARAMETERS
# #
# [*service_url*] # [*service_url*]
@@ -53,16 +65,19 @@
# Defaults to undef # Defaults to undef
# #
class ironic::drivers::inspector ( class ironic::drivers::inspector (
$auth_type = 'password', $auth_type = 'password',
$auth_url = $::os_service_default, $auth_url = $::os_service_default,
$project_name = 'services', $project_name = 'services',
$username = 'ironic', $username = 'ironic',
$password = $::os_service_default, $password = $::os_service_default,
$user_domain_name = 'Default', $user_domain_name = 'Default',
$project_domain_name = 'Default', $project_domain_name = 'Default',
$endpoint_override = $::os_service_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 # DEPRECATED PARAMETERS
$service_url = undef, $service_url = undef,
) { ) {
include ::ironic::deps include ::ironic::deps
@@ -73,13 +88,16 @@ has no effect. Please use ironic::drivers::inspector::endpoint_override instead.
} }
ironic_config { ironic_config {
'inspector/auth_type': value => $auth_type; 'inspector/auth_type': value => $auth_type;
'inspector/username': value => $username; 'inspector/username': value => $username;
'inspector/password': value => $password, secret => true; 'inspector/password': value => $password, secret => true;
'inspector/auth_url': value => $auth_url; 'inspector/auth_url': value => $auth_url;
'inspector/project_name': value => $project_name; 'inspector/project_name': value => $project_name;
'inspector/user_domain_name': value => $user_domain_name; 'inspector/user_domain_name': value => $user_domain_name;
'inspector/project_domain_name': value => $project_domain_name; 'inspector/project_domain_name': value => $project_domain_name;
'inspector/endpoint_override': value => $endpoint_override; '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/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/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/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/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_url').with(:value => '<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('deploy/http_root').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', :api_url => 'https://127.0.0.1:6385',
:provisioning_network => '00000000-0000-0000-0000-000000000000', :provisioning_network => '00000000-0000-0000-0000-000000000000',
:rescuing_network => '00000000-0000-0000-0000-000000000000', :rescuing_network => '00000000-0000-0000-0000-000000000000',
:inspection_network => '00000000-0000-0000-0000-000000000000',
:cleaning_disk_erase => 'metadata', :cleaning_disk_erase => 'metadata',
:http_url => 'http://host:port', :http_url => 'http://host:port',
:http_root => '/src/www', :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/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/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/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_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/erase_devices_metadata_priority').with_value(10)
is_expected.to contain_ironic_config('deploy/http_url').with_value(p[:http_url]) 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', :provisioning_network_name => 'abc',
:cleaning_network_name => 'abc', :cleaning_network_name => 'abc',
:rescuing_network_name => 'abc', :rescuing_network_name => 'abc',
:inspection_network_name => 'abc',
) )
end end
it 'should set provisioning/cleaning/rescuing with new value' do 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/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/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/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
end end

View File

@@ -47,14 +47,17 @@ describe 'ironic::drivers::inspector' do
context 'when overriding parameters' do context 'when overriding parameters' do
before :each do before :each do
params.merge!( params.merge!(
:auth_type => 'noauth', :auth_type => 'noauth',
:auth_url => 'http://example.com', :auth_url => 'http://example.com',
:project_name => 'project1', :project_name => 'project1',
:username => 'admin', :username => 'admin',
:password => 'pa$$w0rd', :password => 'pa$$w0rd',
:user_domain_name => 'NonDefault', :user_domain_name => 'NonDefault',
:project_domain_name => 'NonDefault', :project_domain_name => 'NonDefault',
:endpoint_override => 'http://example2.com', :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 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/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/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/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
end end