Enable no IP address to be returned

Currently 'noop' network_interface users are unable to use
grub to pxe boot machines as the original code path expected
always use IP addresses for the lookup. We've previously
changed the default template, so now there is really no
reason to error at this point, since we should be able to
continue ahead and still boot the instance.

Change-Id: I928ad2c493802a60d77afdb7d4827d820652512c
Story: 1683777
Task: 33759
This commit is contained in:
Julia Kreger 2017-08-30 22:25:24 +00:00
parent ed5c3d940d
commit ac8b2d01b0
3 changed files with 19 additions and 4 deletions

View File

@ -139,9 +139,18 @@ def _link_ip_address_pxe_configs(task, hex_form, ipxe_enabled=False):
api = dhcp_factory.DHCPFactory().provider
ip_addrs = api.get_ip_addresses(task)
if not ip_addrs:
raise exception.FailedToGetIPAddressOnPort(_(
"Failed to get IP address for any port on node %s.") %
task.node.uuid)
if ip_addrs == []:
LOG.warning("No IP addresses assigned for node %(node)s.",
{'node': task.node.uuid})
else:
LOG.warning(
"DHCP address management is not available for node "
"%(node)s. Operators without Neutron can ignore this "
"warning.",
{'node': task.node.uuid})
# Just in case, reset to empty list if we got nothing.
ip_addrs = []
for port_ip_address in ip_addrs:
ip_address_path = _get_pxe_ip_address_path(port_ip_address,
hex_form)

View File

@ -83,7 +83,6 @@ class BaseDHCP(object):
:raises: FailedToUpdateDHCPOptOnPort
"""
@abc.abstractmethod
def get_ip_addresses(self, task):
"""Get IP addresses for all ports/portgroups in `task`.
@ -91,6 +90,7 @@ class BaseDHCP(object):
:returns: List of IP addresses associated with
task's ports and portgroups.
"""
return []
def clean_dhcp_opts(self, task):
"""Clean up the DHCP BOOT options for all ports in `task`.

View File

@ -0,0 +1,6 @@
---
fixes:
- |
Fixes an issue where users attempting to leverage non-iPXE UEFI booting
would experience failures when their ``dhcp_provider`` was set to
``none``.