Merge "Enable no IP address to be returned"

This commit is contained in:
Zuul 2019-08-12 10:57:43 +00:00 committed by Gerrit Code Review
commit 61a58ec249
3 changed files with 19 additions and 4 deletions

View File

@ -137,9 +137,18 @@ def _link_ip_address_pxe_configs(task, 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)
ironic_utils.unlink_without_raise(ip_address_path)

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