From ac8b2d01b056997955a2ca071ac3da6525354fca Mon Sep 17 00:00:00 2001 From: Julia Kreger Date: Wed, 30 Aug 2017 22:25:24 +0000 Subject: [PATCH] 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 --- ironic/common/pxe_utils.py | 15 ++++++++++++--- ironic/dhcp/base.py | 2 +- ...s-noop-network-with-grub-8fd99a73b593ddba.yaml | 6 ++++++ 3 files changed, 19 insertions(+), 4 deletions(-) create mode 100644 releasenotes/notes/fixes-noop-network-with-grub-8fd99a73b593ddba.yaml diff --git a/ironic/common/pxe_utils.py b/ironic/common/pxe_utils.py index 901d81d912..3b2d9795fb 100644 --- a/ironic/common/pxe_utils.py +++ b/ironic/common/pxe_utils.py @@ -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) diff --git a/ironic/dhcp/base.py b/ironic/dhcp/base.py index 88dd3e4e0d..39fa34c7cd 100644 --- a/ironic/dhcp/base.py +++ b/ironic/dhcp/base.py @@ -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`. diff --git a/releasenotes/notes/fixes-noop-network-with-grub-8fd99a73b593ddba.yaml b/releasenotes/notes/fixes-noop-network-with-grub-8fd99a73b593ddba.yaml new file mode 100644 index 0000000000..1d8f0e8308 --- /dev/null +++ b/releasenotes/notes/fixes-noop-network-with-grub-8fd99a73b593ddba.yaml @@ -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``.