Add support to set option:mtu in inspector dnsmasq

It should be possible to configure the DHCP server to
provide the mtu option for inspection subnets.

This uses the dhcp-option-force so that the option is
provided also when the client does not ask for it.
According to dnsmasq manual page this is sometimes
required when sending options to PXELINUX.

Closes-Bug: #1845487
Change-Id: Ic95dbf1867fb5397f1b6d8f23466910a97051cb6
(cherry picked from commit 03550bc8c8)
This commit is contained in:
Harald Jensås 2019-09-26 13:40:08 +02:00
parent b870936fdf
commit 62286d200a
5 changed files with 33 additions and 3 deletions

View File

@ -147,7 +147,7 @@
# 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'},
# [{'ip_range' => '192.168.0.100,192.168.0.120', 'mtu' => '1500'},
# {'tag' => 'subnet1',
# 'ip_range' => '192.168.1.100,192.168.1.200',
# 'netmask' => '255.255.255.0',

View File

@ -0,0 +1,8 @@
---
fixes:
- |
It was not possible to configre Ironic Inspector DHCP (dnsmasq) service to
provide the MTU option. This caused inspection to fail when operating on
a network with <1500 bytes MTU. See bug: `1845487
<https://bugs.launchpad.net/puppet-ironic/+bug/1845487>`_.

View File

@ -46,11 +46,13 @@ describe 'ironic::inspector' do
:swift_tenant_name => 'services',
:swift_auth_url => 'http://127.0.0.1:5000/v2.0',
:dnsmasq_ip_subnets => [{ 'ip_range' =>
'192.168.0.100,192.168.0.120' },
'192.168.0.100,192.168.0.120',
'mtu' => '1350'},
{ 'tag' => 'subnet1',
'ip_range' => '192.168.1.100,192.168.1.200',
'netmask' => '255.255.255.0',
'gateway' => '192.168.1.254' },
'gateway' => '192.168.1.254',
'mtu' => '1350'},
{ 'tag' => 'subnet2',
'ip_range' => '192.168.2.100,192.168.2.200',
'netmask' => '255.255.255.0',
@ -145,12 +147,18 @@ describe 'ironic::inspector' do
is_expected.to contain_file('/etc/ironic-inspector/dnsmasq.conf').with_content(
/dhcp-range=192.168.0.100,192.168.0.120,10m/
)
is_expected.to contain_file('/etc/ironic-inspector/dnsmasq.conf').with_content(
/dhcp-option-force=option:mtu,1350/
)
is_expected.to contain_file('/etc/ironic-inspector/dnsmasq.conf').with_content(
/dhcp-range=set:subnet1,192.168.1.100,192.168.1.200,255.255.255.0,10m/
)
is_expected.to contain_file('/etc/ironic-inspector/dnsmasq.conf').with_content(
/dhcp-option=tag:subnet1,option:router,192.168.1.254/
)
is_expected.to contain_file('/etc/ironic-inspector/dnsmasq.conf').with_content(
/dhcp-option-force=tag:subnet1,option:mtu,1350/
)
is_expected.to contain_file('/etc/ironic-inspector/dnsmasq.conf').with_content(
/dhcp-range=set:subnet2,192.168.2.100,192.168.2.200,255.255.255.0,10m/
)

View File

@ -19,6 +19,13 @@ dhcp-option=tag:<%= s['tag'] -%>,option:router,<%= s['gateway'] %>
dhcp-option=option:router,<%= s['gateway'] %>
<% end -%>
<% end -%>
<% if s['mtu'] -%>
<% if s['tag'] -%>
dhcp-option-force=tag:<%= s['tag'] -%>,option:mtu,<%= s['mtu'] %>
<% else -%>
dhcp-option-force=option:mtu,<%= s['mtu'] %>
<% end -%>
<% end -%>
<% end -%>
dhcp-sequential-ip
dhcp-match=ipxe,175

View File

@ -19,6 +19,13 @@ dhcp-option=tag:<%= s['tag'] -%>,option:router,<%= s['gateway'] %>
dhcp-option=option:router,<%= s['gateway'] %>
<% end -%>
<% end -%>
<% if s['mtu'] -%>
<% if s['tag'] -%>
dhcp-option-force=tag:<%= s['tag'] -%>,option:mtu,<%= s['mtu'] %>
<% else -%>
dhcp-option-force=option:mtu,<%= s['mtu'] %>
<% end -%>
<% end -%>
<% end -%>
dhcp-boot=pxelinux.0,localhost.localdomain,<%= @dnsmasq_local_ip %>
dhcp-sequential-ip