From 4f67b341eef9f0a84afefdbe63133c3449d2e1eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Harald=20Jens=C3=A5s?= Date: Fri, 27 Aug 2021 18:21:49 +0200 Subject: [PATCH] inspector dnsmasq: make sequential-ip configurable Add the parameter ``dnsmasq_dhcp_sequential_ip`` to the ironic::inspector class. When true (the default) dnsmasq is configured to serve addresses in sequential orders. Some DHCPv6 clients don't operate well with a DHCP server that serves addresses sequentially. The new parameter allow disabling sequential addressing to improve interoperability with DHCPv6 clients in UEFI firmware. Closes-Bug: #1941908 Change-Id: Iad32434790a1744249b284937c6b67e9b58a235f --- manifests/inspector.pp | 5 +++++ ...nsmasq-sequential-ip-configurable-739924e5ee69a51d.yaml | 7 +++++++ spec/classes/ironic_inspector_spec.rb | 7 +++++++ templates/inspector_dnsmasq_http.erb | 2 ++ templates/inspector_dnsmasq_tftp.erb | 2 ++ 5 files changed, 23 insertions(+) create mode 100644 releasenotes/notes/dnsmasq-sequential-ip-configurable-739924e5ee69a51d.yaml diff --git a/manifests/inspector.pp b/manifests/inspector.pp index 9c8a720a..18e53a0e 100644 --- a/manifests/inspector.pp +++ b/manifests/inspector.pp @@ -99,6 +99,10 @@ # (optional) IP interface for the dnsmasq process # Defaults to '192.168.0.1' # +# [*dnsmasq_dhcp_sequential_ip*] +# (optional) When true enable the 'dhcp-sequential-ip' option for dnsmasq. +# Defaults to true +# # [*dnsmasq_dhcp_hostsdir*] # (optional) directory with DHCP hosts, only used with the "dnsmasq" PXE # filter. @@ -273,6 +277,7 @@ class ironic::inspector ( $store_data = 'none', $dnsmasq_ip_subnets = [], $dnsmasq_local_ip = '192.168.0.1', + $dnsmasq_dhcp_sequential_ip = true, $dnsmasq_dhcp_hostsdir = undef, $sync_db = true, $ramdisk_collectors = 'default', diff --git a/releasenotes/notes/dnsmasq-sequential-ip-configurable-739924e5ee69a51d.yaml b/releasenotes/notes/dnsmasq-sequential-ip-configurable-739924e5ee69a51d.yaml new file mode 100644 index 00000000..7d44aef7 --- /dev/null +++ b/releasenotes/notes/dnsmasq-sequential-ip-configurable-739924e5ee69a51d.yaml @@ -0,0 +1,7 @@ +--- +features: + - | + It is now possible to disable sequential ip addressing in the ironic + inspector dnsmasq service. The ``ironic::inspector`` class has the new + parameter ``dnsmasq_dhcp_sequential_ip`` *(defaults to: true)*. Set it + to ``false`` to disable sequential ip addressing. diff --git a/spec/classes/ironic_inspector_spec.rb b/spec/classes/ironic_inspector_spec.rb index 7b864a21..dd05776a 100644 --- a/spec/classes/ironic_inspector_spec.rb +++ b/spec/classes/ironic_inspector_spec.rb @@ -193,6 +193,9 @@ describe 'ironic::inspector' do is_expected.not_to contain_file('/etc/ironic-inspector/dnsmasq.conf').with_content( /dhcp-option=tag:subnet3,option:router,2001:4888:a03:313a:c0:fe0:0:c000/ ) + is_expected.to contain_file('/etc/ironic-inspector/dnsmasq.conf').with_content( + /dhcp-sequential-ip/ + ) end it 'should contain file /tftpboot/pxelinux.cfg/default' do is_expected.to contain_file('/tftpboot/pxelinux.cfg/default').with( @@ -231,6 +234,7 @@ describe 'ironic::inspector' do :node_not_found_hook => 'enroll', :discovery_default_driver => 'pxe_ipmitool', :dnsmasq_ip_subnets => [{'ip_range' => '192.168.0.100,192.168.0.120'}], + :dnsmasq_dhcp_sequential_ip => false, :add_ports => 'all', :always_store_ramdisk_logs => true, :port_physnet_cidr_map => {'192.168.20.0/24' => 'physnet_a', @@ -280,6 +284,9 @@ describe 'ironic::inspector' do is_expected.to contain_file('/etc/ironic-inspector/dnsmasq.conf').with_content( /dhcp-option=tag:ipxe6,option6:bootfile-url,http:\/\/.*:3816\/inspector.ipxe/ ) + is_expected.not_to contain_file('/etc/ironic-inspector/dnsmasq.conf').with_content( + /dhcp-sequential-ip/ + ) end it 'should contain file /var/www/httpboot/inspector.ipxe' do is_expected.to contain_file('/var/www/httpboot/inspector.ipxe').with( diff --git a/templates/inspector_dnsmasq_http.erb b/templates/inspector_dnsmasq_http.erb index e6af0506..37c8af86 100644 --- a/templates/inspector_dnsmasq_http.erb +++ b/templates/inspector_dnsmasq_http.erb @@ -38,7 +38,9 @@ dhcp-option=option:classless-static-route,<%= @_routes.join(',') -%> <% end -%> <% end -%> <% end -%> +<% if @dnsmasq_dhcp_sequential_ip -%> dhcp-sequential-ip +<% end -%> dhcp-match=ipxe,175 dhcp-match=set:efi,option:client-arch,7 dhcp-match=set:efi,option:client-arch,9 diff --git a/templates/inspector_dnsmasq_tftp.erb b/templates/inspector_dnsmasq_tftp.erb index db3b06ce..6cda44f5 100644 --- a/templates/inspector_dnsmasq_tftp.erb +++ b/templates/inspector_dnsmasq_tftp.erb @@ -39,7 +39,9 @@ dhcp-option=option:classless-static-route,<%= @_routes.join(',') -%> <% end -%> <% end -%> dhcp-boot=pxelinux.0,localhost.localdomain,<%= @dnsmasq_local_ip %> +<% if @dnsmasq_dhcp_sequential_ip -%> dhcp-sequential-ip +<% end -%> <% if @dnsmasq_dhcp_hostsdir %> dhcp-hostsdir=<%= @dnsmasq_dhcp_hostsdir %> <% end %>