Fix IPv6 iPXE support

Adds transmission of an `ipxe6` tag to neutron which is required
for neutron to appropriately match and supply configuration to
hosts over DHCPv6 when iPXE is in use.

This is because neutron prepends options based upon its
perception of the IP version being used and the detection of
iPXE actively being used varries between IPv4 and IPv6.

Story: 2004502
Task: 28221

Change-Id: If68926fd215f707394e5d6a0af9daa9232216abe
This commit is contained in:
Julia Kreger 2019-01-02 09:08:25 -08:00
parent 565cd192fc
commit cbf1e9d034
3 changed files with 43 additions and 2 deletions

View File

@ -465,15 +465,35 @@ def dhcp_options_for_instance(task, ipxe_enabled=False, url_boot=False):
# if the request comes from dumb firmware send them the iPXE
# boot image.
if dhcp_provider_name == 'neutron':
# Neutron use dnsmasq as default DHCP agent, add extra config
# to neutron "dhcp-match=set:ipxe,175" and use below option
# Neutron use dnsmasq as default DHCP agent. Neutron carries the
# configuration to relate to the tags below. The ipxe6 tag was
# 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})
else:
# !175 == non-iPXE.
# http://ipxe.org/howto/dhcpd#ipxe-specific_options
if ip_version == 6:
LOG.warning('IPv6 is enabled and the DHCP driver appears set '
'to a plugin aside from "neutron". Node %(name)s '
'may not receive proper DHCPv6 provided '
'boot parameters.'.format(name=task.node.uuid))
# NOTE(TheJulia): This was added for ISC DHCPd support, however it
# appears that isc support was never added to neutron and is likely
# a down stream driver.
dhcp_opts.append({'opt_name': "!%s,%s" % (DHCP_IPXE_ENCAP_OPTS,
boot_file_param),
'opt_value': boot_file})

View File

@ -860,13 +860,23 @@ class TestPXEUtils(db_base.DbTestCase):
expected_info = [{'opt_name': 'tag:!ipxe,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}]
elif ip_version == 4:
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},
@ -876,6 +886,9 @@ 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,8 @@
---
fixes:
- |
Fixes an issue has been corrected where hosts executing ``iPXE`` to boot
would error indicating that no configuration was found for networks where
IPv6 is in use. This has been remedied through a minor addition to the
Networking service in the Stein development cycle. For more information
please see `story 2004502 <https://storyboard.openstack.org/#!/story/2004502>`_.