Merge "Remove ipxe tags when ipx6 is in use."

This commit is contained in:
Zuul
2019-06-17 02:56:54 +00:00
committed by Gerrit Code Review
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.