Revert "Change pxe dhcp options name to codes."

This reverts commit c377f5cbbd.

Rajini Karthik discovered that this broke the hardware builds (dell and
oneview, maybe others) -- it caused a TFTP timeout issue. Builds started
failing after it merged (approximately Sep15th midnight) and the builds
on stable/ocata and stable/pike are passing. Rajini reverted this patch
on the Dell CI temporarily and the tests passed.

Change-Id: Id1ef4441511a36f8fc6d639f4bb1dd52cd630445
This commit is contained in:
Ruby Loo 2017-09-20 20:24:41 +00:00
parent c377f5cbbd
commit 41fcc401d8
3 changed files with 19 additions and 31 deletions

View File

@ -33,12 +33,6 @@ LOG = logging.getLogger(__name__)
PXE_CFG_DIR_NAME = 'pxelinux.cfg'
DHCP_TFTP_SERVER_NAME = '66' # rfc2132
DHCP_BOOTFILE_NAME = '67' # rfc2132
DHCP_TFTP_SERVER_ADDRESS = '150' # rfc5859
DHCP_IPXE_ENCAP_OPTS = '175' # Tentatively Assigned
DHCP_TFTP_PATH_PREFIX = '210' # rfc5071
def get_root_dir():
"""Returns the directory where the config files and images will live."""
@ -323,31 +317,30 @@ def dhcp_options_for_instance(task):
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
dhcp_opts.append({'opt_name': "tag:!ipxe,%s" % DHCP_BOOTFILE_NAME,
dhcp_opts.append({'opt_name': 'tag:!ipxe,bootfile-name',
'opt_value': boot_file})
dhcp_opts.append({'opt_name': "tag:ipxe,%s" % DHCP_BOOTFILE_NAME,
dhcp_opts.append({'opt_name': 'tag:ipxe,bootfile-name',
'opt_value': ipxe_script_url})
else:
# !175 == non-iPXE.
# http://ipxe.org/howto/dhcpd#ipxe-specific_options
dhcp_opts.append({'opt_name': "!%s,%s" % (DHCP_IPXE_ENCAP_OPTS,
DHCP_BOOTFILE_NAME),
dhcp_opts.append({'opt_name': '!175,bootfile-name',
'opt_value': boot_file})
dhcp_opts.append({'opt_name': DHCP_BOOTFILE_NAME,
dhcp_opts.append({'opt_name': 'bootfile-name',
'opt_value': ipxe_script_url})
else:
dhcp_opts.append({'opt_name': DHCP_BOOTFILE_NAME,
dhcp_opts.append({'opt_name': 'bootfile-name',
'opt_value': boot_file})
# 210 == tftp server path-prefix or tftp root, will be used to find
# pxelinux.cfg directory. The pxelinux.0 loader infers this information
# from it's own path, but Petitboot needs it to be specified by this
# option since it doesn't use pxelinux.0 loader.
dhcp_opts.append({'opt_name': DHCP_TFTP_PATH_PREFIX,
dhcp_opts.append({'opt_name': '210',
'opt_value': get_tftp_path_prefix()})
dhcp_opts.append({'opt_name': DHCP_TFTP_SERVER_NAME,
dhcp_opts.append({'opt_name': 'server-ip-address',
'opt_value': CONF.pxe.tftp_server})
dhcp_opts.append({'opt_name': DHCP_TFTP_SERVER_ADDRESS,
dhcp_opts.append({'opt_name': 'tftp-server',
'opt_value': CONF.pxe.tftp_server})
# Append the IP version for all the configuration options

View File

@ -621,16 +621,16 @@ class TestPXEUtils(db_base.DbTestCase):
self.config(tftp_server='192.0.2.1', group='pxe')
self.config(pxe_bootfile_name='fake-bootfile', group='pxe')
self.config(tftp_root='/tftp-path/', group='pxe')
expected_info = [{'opt_name': '67',
expected_info = [{'opt_name': 'bootfile-name',
'opt_value': 'fake-bootfile',
'ip_version': ip_version},
{'opt_name': '210',
'opt_value': '/tftp-path/',
'ip_version': ip_version},
{'opt_name': '66',
{'opt_name': 'server-ip-address',
'opt_value': '192.0.2.1',
'ip_version': ip_version},
{'opt_name': '150',
{'opt_name': 'tftp-server',
'opt_value': '192.0.2.1',
'ip_version': ip_version},
]
@ -689,16 +689,16 @@ class TestPXEUtils(db_base.DbTestCase):
self.config(dhcp_provider='isc', group='dhcp')
expected_boot_script_url = 'http://192.0.3.2:1234/boot.ipxe'
expected_info = [{'opt_name': '!175,67',
expected_info = [{'opt_name': '!175,bootfile-name',
'opt_value': boot_file,
'ip_version': 4},
{'opt_name': '66',
{'opt_name': 'server-ip-address',
'opt_value': '192.0.2.1',
'ip_version': 4},
{'opt_name': '150',
{'opt_name': 'tftp-server',
'opt_value': '192.0.2.1',
'ip_version': 4},
{'opt_name': '67',
{'opt_name': 'bootfile-name',
'opt_value': expected_boot_script_url,
'ip_version': 4}]
@ -707,16 +707,16 @@ class TestPXEUtils(db_base.DbTestCase):
self.config(dhcp_provider='neutron', group='dhcp')
expected_boot_script_url = 'http://192.0.3.2:1234/boot.ipxe'
expected_info = [{'opt_name': 'tag:!ipxe,67',
expected_info = [{'opt_name': 'tag:!ipxe,bootfile-name',
'opt_value': boot_file,
'ip_version': 4},
{'opt_name': '66',
{'opt_name': 'server-ip-address',
'opt_value': '192.0.2.1',
'ip_version': 4},
{'opt_name': '150',
{'opt_name': 'tftp-server',
'opt_value': '192.0.2.1',
'ip_version': 4},
{'opt_name': 'tag:ipxe,67',
{'opt_name': 'tag:ipxe,bootfile-name',
'opt_value': expected_boot_script_url,
'ip_version': 4}]

View File

@ -1,5 +0,0 @@
---
fixes:
- |
Fixes compatibility with Neutron DHCP backends other than dnsmasq by using
standard DHCP option codes instead of dnsmasq-specific option names.