Add support for classless-static-routes in inspector dnsmasq
Advanced users may need to push advanced routing to the client. Add the possbility to configure the classless-static-route (dhcp option: 121) in ironic inspectors dnsmasq. Change-Id: I2229d386bff8ae63e4efe8406770b2b378a1991f Related-Bug: #1819464
This commit is contained in:
parent
95364eff50
commit
c192ee40ac
@ -142,20 +142,24 @@
|
||||
# Defautls to 'http://127.0.0.1:5000/v3'
|
||||
#
|
||||
# [*dnsmasq_ip_subnets*]
|
||||
# (optional) List of hashes with keys: 'tag', 'ip_range', 'netmask', and
|
||||
# 'gateway'. 'ip_range' is the only required key. Assigning multiple tagged
|
||||
# subnets allow dnsmasq to serve dhcp request that came in via dhcp
|
||||
# relay/helper.
|
||||
# (optional) List of hashes with keys: 'tag', 'ip_range', 'netmask',
|
||||
# 'gateway' and 'classless_static_routes'. 'ip_range' is the only required
|
||||
# key. Assigning multiple tagged subnets allow dnsmasq to serve dhcp request
|
||||
# that came in via dhcp relay/helper.
|
||||
# Example:
|
||||
# [{'ip_range' => '192.168.0.100,192.168.0.120'},
|
||||
# {'tag' => 'subnet1',
|
||||
# 'ip_range' => '192.168.1.100,192.168.1.200',
|
||||
# 'netmask' => '255.255.255.0',
|
||||
# 'gateway' => '192.168.1.254'},
|
||||
# {'tag' => 'subnet2',
|
||||
# 'ip_range' => '192.168.2.100,192.168.2.200',
|
||||
# 'netmask' => '255.255.255.0',
|
||||
# 'gateway' => '192.168.2.254'}]
|
||||
# {'tag' => 'subnet2',
|
||||
# 'ip_range' => '192.168.2.100,192.168.2.200',
|
||||
# 'netmask' => '255.255.255.0',
|
||||
# 'gateway' => '192.168.2.254',
|
||||
# 'classless_static_routes' => [{'destination' => '1.2.3.0/24',
|
||||
# 'nexthop' => '192.168.2.1'},
|
||||
# {'destination' => '4.5.6.0/24',
|
||||
# 'nexthop' => '192.168.2.1'}]}]
|
||||
# Defaults to []
|
||||
#
|
||||
# [*dnsmasq_local_ip*]
|
||||
|
@ -0,0 +1,18 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
*Classless static routes* can now be configured for ironic inspector
|
||||
subnets. The ``dnsmasq_ip_subnets`` has been extended to support the
|
||||
``classless_static_routes`` key in a subnet defention. This allow advanced
|
||||
routing options to be pushed to the inspection ramdisk. For example::
|
||||
|
||||
dnsmasq_ip_subnets = [
|
||||
{ 'tag' => 'subnet2',
|
||||
'ip_range' => '192.168.2.100,192.168.2.200',
|
||||
'netmask' => '255.255.255.0',
|
||||
'gateway' => '192.168.2.254',
|
||||
'classless_static_routes' => [
|
||||
{'destination' => '1.2.3.0/24', 'nexthop' => '192.168.2.1'},
|
||||
{'destination' => '4.5.6.0/24', 'nexthop' => '192.168.2.1'}],
|
||||
},
|
||||
]
|
@ -51,10 +51,14 @@ describe 'ironic::inspector' do
|
||||
'ip_range' => '192.168.1.100,192.168.1.200',
|
||||
'netmask' => '255.255.255.0',
|
||||
'gateway' => '192.168.1.254' },
|
||||
{ 'tag' => 'subnet2',
|
||||
'ip_range' => '192.168.2.100,192.168.2.200',
|
||||
'netmask' => '255.255.255.0',
|
||||
'gateway' => '192.168.2.254' }],
|
||||
{ 'tag' => 'subnet2',
|
||||
'ip_range' => '192.168.2.100,192.168.2.200',
|
||||
'netmask' => '255.255.255.0',
|
||||
'gateway' => '192.168.2.254',
|
||||
'classless_static_routes' => [{'destination' => '1.2.3.0/24',
|
||||
'nexthop' => '192.168.2.1'},
|
||||
{'destination' => '4.5.6.0/24',
|
||||
'nexthop' => '192.168.2.1'}]}],
|
||||
:dnsmasq_local_ip => '192.168.0.1',
|
||||
:ipxe_timeout => 0,
|
||||
:http_port => 8088,
|
||||
@ -157,6 +161,9 @@ describe 'ironic::inspector' do
|
||||
is_expected.to contain_file('/etc/ironic-inspector/dnsmasq.conf').with_content(
|
||||
/dhcp-option=tag:subnet2,option:router,192.168.2.254/
|
||||
)
|
||||
is_expected.to contain_file('/etc/ironic-inspector/dnsmasq.conf').with_content(
|
||||
/dhcp-option=tag:subnet2,option:classless-static-route,1.2.3.0\/24,192.168.2.1,4.5.6.0\/24,192.168.2.1/
|
||||
)
|
||||
end
|
||||
it 'should contain file /tftpboot/pxelinux.cfg/default' do
|
||||
is_expected.to contain_file('/tftpboot/pxelinux.cfg/default').with(
|
||||
|
@ -19,6 +19,17 @@ dhcp-option=tag:<%= s['tag'] -%>,option:router,<%= s['gateway'] %>
|
||||
dhcp-option=option:router,<%= s['gateway'] %>
|
||||
<% end -%>
|
||||
<% end -%>
|
||||
<% if s['classless_static_routes'] -%>
|
||||
<%- @_routes = [] -%>
|
||||
<%- s['classless_static_routes'].each do |route| -%>
|
||||
<%- @_routes << route['destination'] + ',' + route['nexthop'] -%>
|
||||
<% end -%>
|
||||
<% if s['tag'] -%>
|
||||
dhcp-option=tag:<%= s['tag'] -%>,option:classless-static-route,<%= @_routes.join(',') -%>
|
||||
<% else -%>
|
||||
dhcp-option=option:classless-static-route,<%= @_routes.join(',') -%>
|
||||
<% end -%>
|
||||
<% end -%>
|
||||
<% end -%>
|
||||
dhcp-sequential-ip
|
||||
dhcp-match=ipxe,175
|
||||
|
@ -19,6 +19,17 @@ dhcp-option=tag:<%= s['tag'] -%>,option:router,<%= s['gateway'] %>
|
||||
dhcp-option=option:router,<%= s['gateway'] %>
|
||||
<% end -%>
|
||||
<% end -%>
|
||||
<% if s['classless_static_routes'] -%>
|
||||
<%- @_routes = [] -%>
|
||||
<%- s['classless_static_routes'].each do |route| -%>
|
||||
<%- @_routes << route['destination'] + ',' + route['nexthop'] -%>
|
||||
<% end -%>
|
||||
<% if s['tag'] -%>
|
||||
dhcp-option=tag:<%= s['tag'] -%>,option:classless-static-route,<%= @_routes.join(',') -%>
|
||||
<% else -%>
|
||||
dhcp-option=option:classless-static-route,<%= @_routes.join(',') -%>
|
||||
<% end -%>
|
||||
<% end -%>
|
||||
<% end -%>
|
||||
dhcp-boot=pxelinux.0,localhost.localdomain,<%= @dnsmasq_local_ip %>
|
||||
dhcp-sequential-ip
|
||||
|
Loading…
Reference in New Issue
Block a user