Remove ipxe tags when ipx6 is in use.

Turns out the dhcp server doesn't always do the right thing
and our duplicated tags seem to create confusion. So lets
remove them so ipxe6 will work.

Change-Id: I446cb814ae41cfd1e9a4ed45f27dac17e9b5bb61
Story: 2005885
Task: 33734
This commit is contained in:
Julia Kreger 2019-06-13 16:43:00 -07:00
parent c59dc1386f
commit 2fde1940b5
3 changed files with 23 additions and 26 deletions

View File

@ -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

View File

@ -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}]

View File

@ -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.