port_physnet_cidr_map support
Add support for laying out the configuration for the physnet_cidr_map processing hook. Related-Bug: #1870529 Change-Id: I5f0f3b254edf25fdcfa328f42d8bf4324e5bbd0d
This commit is contained in:
parent
ca47ba7c7f
commit
271907c7d6
@ -171,6 +171,14 @@
|
||||
# transport://user:pass@host1:port[,hostN:portN]/virtual_host
|
||||
# Defaults to 'fake://'
|
||||
#
|
||||
# [*port_physnet_cidr_map*]
|
||||
# (optional) Hash where key's are CIDR and values are physical network.
|
||||
# Mapping of IP subnet CIDR to physical network. When the
|
||||
# physnet_cidr_map processing hook is enabled the physical_network property
|
||||
# of baremetal ports is populated based on this mapping.
|
||||
# Example: {'10.10.10.0/24' => 'physnet_a', '2001:db8::/64' => 'physnet_b'}
|
||||
# Defaults to {}
|
||||
#
|
||||
# DEPRECATED PARAMETERS
|
||||
#
|
||||
# [*swift_auth_type*]
|
||||
@ -281,6 +289,7 @@ class ironic::inspector (
|
||||
$discovery_default_driver = $::os_service_default,
|
||||
$enable_ppc64le = false,
|
||||
$default_transport_url = 'fake://',
|
||||
$port_physnet_cidr_map = {},
|
||||
# DEPRECATED PARAMETERS
|
||||
$swift_auth_type = undef,
|
||||
$swift_username = undef,
|
||||
@ -322,6 +331,10 @@ Use ironic::inspector::ironic::endpoint_override instead.')
|
||||
fail('Invalid data type, parameter dnsmasq_ip_subnets must be Array type')
|
||||
}
|
||||
|
||||
if !is_hash($port_physnet_cidr_map) {
|
||||
fail('Invalid data type, parameter port_physnet_cidr_map mush be Hash type')
|
||||
}
|
||||
|
||||
$tftp_root_real = pick($::ironic::pxe::common::tftp_root, $tftp_root)
|
||||
$http_root_real = pick($::ironic::pxe::common::http_root, $http_root)
|
||||
$http_port_real = pick($::ironic::pxe::common::http_port, $http_port)
|
||||
@ -386,6 +399,9 @@ Use ironic::inspector::ironic::endpoint_override instead.')
|
||||
#140 chars exeeded error in puppet-lint
|
||||
$p_hooks = join(delete_undef_values(['$default_processing_hooks', $additional_processing_hooks]), ',')
|
||||
|
||||
# Convert the hash to comma separated string of <key>:<value> pairs.
|
||||
$port_physnet_cidr_map_real = join($port_physnet_cidr_map.map | $i | { join($i, ':') }, ',')
|
||||
|
||||
ironic_inspector_config {
|
||||
'DEFAULT/listen_address': value => $listen_address;
|
||||
'DEFAULT/auth_strategy': value => $auth_strategy;
|
||||
@ -403,6 +419,7 @@ Use ironic::inspector::ironic::endpoint_override instead.')
|
||||
'processing/processing_hooks': value => $p_hooks;
|
||||
'processing/node_not_found_hook': value => $node_not_found_hook;
|
||||
'discovery/enroll_node_driver': value => $discovery_default_driver;
|
||||
'port_physnet/cidr_map': value => $port_physnet_cidr_map_real;
|
||||
}
|
||||
|
||||
# Install package
|
||||
|
@ -0,0 +1,7 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
Added the parameter ``port_physnet_cidr_map`` which takes a hash mapping IP
|
||||
subnet CIDR to physical network. When the physnet_cidr_map processing hook
|
||||
is enabled the physical_network property of baremetal ports is populated
|
||||
based on this mapping.
|
@ -136,6 +136,7 @@ describe 'ironic::inspector' do
|
||||
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>')
|
||||
is_expected.to contain_ironic_inspector_config('port_physnet/cidr_map').with_value('')
|
||||
end
|
||||
|
||||
it 'should contain file /etc/ironic-inspector/inspector.conf' do
|
||||
@ -222,6 +223,8 @@ describe 'ironic::inspector' do
|
||||
:dnsmasq_ip_subnets => [{'ip_range' => '192.168.0.100,192.168.0.120'}],
|
||||
:add_ports => 'all',
|
||||
:always_store_ramdisk_logs => true,
|
||||
:port_physnet_cidr_map => {'192.168.20.0/24' => 'physnet_a',
|
||||
'2001:db8::/64' => 'physnet_b'},
|
||||
)
|
||||
end
|
||||
it 'should replace default parameter with new value' do
|
||||
@ -240,6 +243,7 @@ describe 'ironic::inspector' do
|
||||
is_expected.to contain_ironic_inspector_config('processing/add_ports').with_value('all')
|
||||
is_expected.to contain_ironic_inspector_config('discovery/enroll_node_driver').with_value('pxe_ipmitool')
|
||||
is_expected.to contain_ironic_inspector_config('processing/always_store_ramdisk_logs').with_value(true)
|
||||
is_expected.to contain_ironic_inspector_config('port_physnet/cidr_map').with_value('192.168.20.0/24:physnet_a,2001:db8::/64:physnet_b')
|
||||
end
|
||||
|
||||
it 'should contain file /etc/ironic-inspector/dnsmasq.conf' do
|
||||
|
Loading…
x
Reference in New Issue
Block a user