From 987a46a15dc1cfa541b73c7093ce362569d049dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Harald=20Jens=C3=A5s?= Date: Thu, 26 Sep 2019 13:40:08 +0200 Subject: [PATCH] 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 03550bc8c8d05583e76c335c465684cec6d55093) --- manifests/inspector.pp | 2 +- ...tu-option-inspector-dnsmasq-cee585c2ac49dbc8.yaml | 8 ++++++++ spec/classes/ironic_inspector_spec.rb | 12 ++++++++++-- templates/inspector_dnsmasq_http.erb | 7 +++++++ templates/inspector_dnsmasq_tftp.erb | 7 +++++++ 5 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 releasenotes/notes/allow-passing-mtu-option-inspector-dnsmasq-cee585c2ac49dbc8.yaml diff --git a/manifests/inspector.pp b/manifests/inspector.pp index a227c713..bdf62c0c 100644 --- a/manifests/inspector.pp +++ b/manifests/inspector.pp @@ -147,7 +147,7 @@ # 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'}, +# [{'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', diff --git a/releasenotes/notes/allow-passing-mtu-option-inspector-dnsmasq-cee585c2ac49dbc8.yaml b/releasenotes/notes/allow-passing-mtu-option-inspector-dnsmasq-cee585c2ac49dbc8.yaml new file mode 100644 index 00000000..d1a77bf0 --- /dev/null +++ b/releasenotes/notes/allow-passing-mtu-option-inspector-dnsmasq-cee585c2ac49dbc8.yaml @@ -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 + `_. + diff --git a/spec/classes/ironic_inspector_spec.rb b/spec/classes/ironic_inspector_spec.rb index 425d41e3..0dad0441 100644 --- a/spec/classes/ironic_inspector_spec.rb +++ b/spec/classes/ironic_inspector_spec.rb @@ -46,11 +46,13 @@ describe 'ironic::inspector' do :swift_tenant_name => 'services', :swift_auth_url => 'http://127.0.0.1:5000/v3', :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', @@ -149,12 +151,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/ ) diff --git a/templates/inspector_dnsmasq_http.erb b/templates/inspector_dnsmasq_http.erb index ebfc0cfc..23eda53e 100644 --- a/templates/inspector_dnsmasq_http.erb +++ b/templates/inspector_dnsmasq_http.erb @@ -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 -%> <% if s['classless_static_routes'] -%> <%- @_routes = [] -%> <%- s['classless_static_routes'].each do |route| -%> diff --git a/templates/inspector_dnsmasq_tftp.erb b/templates/inspector_dnsmasq_tftp.erb index 2f8041d3..47830567 100644 --- a/templates/inspector_dnsmasq_tftp.erb +++ b/templates/inspector_dnsmasq_tftp.erb @@ -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 -%> <% if s['classless_static_routes'] -%> <%- @_routes = [] -%> <%- s['classless_static_routes'].each do |route| -%>