Configure ironic-inspector parameters related to node discovery

* node_not_found_hook specifies hook to run when nodes is not found on lookup
* discovery_default_driver specifies the default driver for new nodes

Change-Id: Iddd6d65950b2846883e64af327a34d8bec2dd20d
This commit is contained in:
Dmitry Tantsur 2017-01-20 14:14:17 +01:00
parent ab50e55511
commit 12cbf53aeb
3 changed files with 28 additions and 0 deletions

View File

@ -159,6 +159,16 @@
# (optional) Whether to store the boot mode (BIOS or UEFI). # (optional) Whether to store the boot mode (BIOS or UEFI).
# Defaults to $::os_service_default # Defaults to $::os_service_default
# #
# [*node_not_found_hook*]
# (optional) Plugin to run when a node is not found during lookup.
# For example, "enroll" hook can be used for node auto-discovery.
# Defaults to $::os_service_default
#
# [*discovery_default_driver*]
# (optional) The default driver to use for auto-discovered nodes.
# Requires node_not_found_hook set to "enroll".
# Defaults to $::os_service_default
#
# DEPRECATED # DEPRECATED
# #
# [*enable_uefi*] # [*enable_uefi*]
@ -203,6 +213,8 @@ class ironic::inspector (
$detect_boot_mode = $::os_service_default, $detect_boot_mode = $::os_service_default,
$tftp_root = '/tftpboot', $tftp_root = '/tftpboot',
$http_root = '/httpboot', $http_root = '/httpboot',
$node_not_found_hook = $::os_service_default,
$discovery_default_driver = $::os_service_default,
# DEPRECATED # DEPRECATED
$enable_uefi = undef, $enable_uefi = undef,
) { ) {
@ -301,6 +313,8 @@ tftpboot and httpboot setup, please include ::ironic::pxe")
# Here we use oslo.config interpolation with another option default_processing_hooks, # Here we use oslo.config interpolation with another option default_processing_hooks,
# which we don't change as it might break introspection completely. # which we don't change as it might break introspection completely.
'processing/processing_hooks': value => $p_hooks; 'processing/processing_hooks': value => $p_hooks;
'processing/node_not_found_hook': value => $node_not_found_hook;
'discovery/enroll_node_driver': value => $discovery_default_driver;
} }
# Install package # Install package

View File

@ -0,0 +1,8 @@
---
features:
- New parameter "node_not_found_hook" allows configuring ironic-inspector
plugin to run when a node is not found during lookup. For example,
"enroll" hook implements node auto-discovery.
- New parameter "discovery_default_driver" allows configuring the default
driver to be set by ironic-inspector for newly discovered nodes, when
"node_not_found_hook" is set to "enroll".

View File

@ -110,6 +110,8 @@ describe 'ironic::inspector' do
is_expected.to contain_ironic_inspector_config('swift/project_name').with_value(p[:swift_tenant_name]) is_expected.to contain_ironic_inspector_config('swift/project_name').with_value(p[:swift_tenant_name])
is_expected.to contain_ironic_inspector_config('swift/auth_url').with_value(p[:swift_auth_url]) is_expected.to contain_ironic_inspector_config('swift/auth_url').with_value(p[:swift_auth_url])
is_expected.to contain_ironic_inspector_config('processing/processing_hooks').with_value('$default_processing_hooks') is_expected.to contain_ironic_inspector_config('processing/processing_hooks').with_value('$default_processing_hooks')
is_expected.to contain_ironic_inspector_config('processing/node_not_found_hook').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_inspector_config('discovery/enroll_node_driver').with_value('<SERVICE DEFAULT>')
end end
it 'should contain file /etc/ironic-inspector/inspector.conf' do it 'should contain file /etc/ironic-inspector/inspector.conf' do
@ -156,6 +158,8 @@ describe 'ironic::inspector' do
:tftp_root => '/var/lib/tftpboot', :tftp_root => '/var/lib/tftpboot',
:http_root => '/var/www/httpboot', :http_root => '/var/www/httpboot',
:detect_boot_mode => true, :detect_boot_mode => true,
:node_not_found_hook => 'enroll',
:discovery_default_driver => 'pxe_ipmitool',
) )
end end
it 'should replace default parameter with new value' do it 'should replace default parameter with new value' do
@ -167,6 +171,8 @@ describe 'ironic::inspector' do
is_expected.to contain_ironic_inspector_config('swift/password').with_value(p[:swift_password]) is_expected.to contain_ironic_inspector_config('swift/password').with_value(p[:swift_password])
is_expected.to contain_ironic_inspector_config('swift/auth_url').with_value(p[:swift_auth_url]) is_expected.to contain_ironic_inspector_config('swift/auth_url').with_value(p[:swift_auth_url])
is_expected.to contain_ironic_inspector_config('processing/processing_hooks').with_value('$default_processing_hooks,hook1,hook2') is_expected.to contain_ironic_inspector_config('processing/processing_hooks').with_value('$default_processing_hooks,hook1,hook2')
is_expected.to contain_ironic_inspector_config('processing/node_not_found_hook').with_value('enroll')
is_expected.to contain_ironic_inspector_config('discovery/enroll_node_driver').with_value('pxe_ipmitool')
end end
it 'should contain file /etc/ironic-inspector/dnsmasq.conf' do it 'should contain file /etc/ironic-inspector/dnsmasq.conf' do