diff --git a/ironic/common/pxe_utils.py b/ironic/common/pxe_utils.py index 901d81d912..e6b2586d93 100644 --- a/ironic/common/pxe_utils.py +++ b/ironic/common/pxe_utils.py @@ -470,19 +470,22 @@ def dhcp_options_for_instance(task, ipxe_enabled=False, url_boot=False): # added in the Stein cycle which identifies the iPXE User-Class # directly and is only sent in DHCPv6. - # NOTE(TheJulia): Lets send both, let neutron tag/sort it out as - # an ip_version field is also transmitted. Plus, given the - # semi-obscure nature of this, being more verbose and letting - # the DHCP server do the best thing possible is likely the best - # course of action. - dhcp_opts.append({'opt_name': "tag:!ipxe,%s" % boot_file_param, - 'opt_value': boot_file}) - dhcp_opts.append({'opt_name': "tag:!ipxe6,%s" % boot_file_param, - 'opt_value': boot_file}) - dhcp_opts.append({'opt_name': "tag:ipxe,%s" % boot_file_param, - 'opt_value': ipxe_script_url}) - dhcp_opts.append({'opt_name': "tag:ipxe6,%s" % boot_file_param, - 'opt_value': ipxe_script_url}) + if ip_version != 6: + dhcp_opts.append( + {'opt_name': "tag:!ipxe,%s" % boot_file_param, + 'opt_value': boot_file} + ) + dhcp_opts.append( + {'opt_name': "tag:ipxe,%s" % boot_file_param, + 'opt_value': ipxe_script_url} + ) + else: + dhcp_opts.append( + {'opt_name': "tag:!ipxe6,%s" % boot_file_param, + 'opt_value': boot_file}) + dhcp_opts.append( + {'opt_name': "tag:ipxe6,%s" % boot_file_param, + 'opt_value': ipxe_script_url}) else: # !175 == non-iPXE. # http://ipxe.org/howto/dhcpd#ipxe-specific_options diff --git a/ironic/tests/unit/common/test_pxe_utils.py b/ironic/tests/unit/common/test_pxe_utils.py index 6f1372ee01..b082a059a2 100644 --- a/ironic/tests/unit/common/test_pxe_utils.py +++ b/ironic/tests/unit/common/test_pxe_utils.py @@ -857,15 +857,9 @@ class TestPXEUtils(db_base.DbTestCase): self.config(dhcp_provider='neutron', group='dhcp') if ip_version == 6: # Boot URL variable set from prior test of isc parameters. - expected_info = [{'opt_name': 'tag:!ipxe,59', + expected_info = [{'opt_name': 'tag:!ipxe6,59', 'opt_value': 'tftp://[ff80::1]/fake-bootfile', 'ip_version': ip_version}, - {'opt_name': 'tag:!ipxe6,59', - 'opt_value': 'tftp://[ff80::1]/fake-bootfile', - 'ip_version': ip_version}, - {'opt_name': 'tag:ipxe,59', - 'opt_value': expected_boot_script_url, - 'ip_version': ip_version}, {'opt_name': 'tag:ipxe6,59', 'opt_value': expected_boot_script_url, 'ip_version': ip_version}] @@ -874,9 +868,6 @@ class TestPXEUtils(db_base.DbTestCase): expected_info = [{'opt_name': 'tag:!ipxe,67', 'opt_value': boot_file, 'ip_version': ip_version}, - {'opt_name': 'tag:!ipxe6,67', - 'opt_value': boot_file, - 'ip_version': ip_version}, {'opt_name': '66', 'opt_value': '192.0.2.1', 'ip_version': ip_version}, @@ -886,9 +877,6 @@ class TestPXEUtils(db_base.DbTestCase): {'opt_name': 'tag:ipxe,67', 'opt_value': expected_boot_script_url, 'ip_version': ip_version}, - {'opt_name': 'tag:ipxe6,67', - 'opt_value': expected_boot_script_url, - 'ip_version': ip_version}, {'opt_name': 'server-ip-address', 'opt_value': '192.0.2.1', 'ip_version': ip_version}] diff --git a/releasenotes/notes/remove-ipxe-tags-with-ipv6-cf4b7937c27590d6.yaml b/releasenotes/notes/remove-ipxe-tags-with-ipv6-cf4b7937c27590d6.yaml new file mode 100644 index 0000000000..5e4876212d --- /dev/null +++ b/releasenotes/notes/remove-ipxe-tags-with-ipv6-cf4b7937c27590d6.yaml @@ -0,0 +1,6 @@ +--- +fixes: + - | + Fixes the duplication of the "ipxe" tag when using IPv6, which leads to + the dhcp server possibly returning an incorrect response to the DHCPv6 + client.