fix: iPXE boot interface PXE capability detection

The neutron network interface's add_ports_to_network() function only
checked for 'pxe_boot' capability when determining PXE capability,
but iPXE is also a form of PXE booting and should be treated the
same way. This caused inconsistent behavior for boot interfaces like
'http-ipxe' that have 'ipxe_boot' capability but not 'pxe_boot'
capability.

Without this fix, iPXE boot interfaces were incorrectly treated as
non-PXE capable, causing the neutron interface to create ports for
all baremetal ports with local_link_connection info during cleaning
operations, regardless of their pxe_enabled setting.

This change adds 'pxe_boot' capability to both iPXEBoot and
iPXEHttpBoot classes, ensuring that iPXE boot interfaces are
correctly recognized as PXE-capable.

Additionally, this adds the missing pxe_boot capability check to
the remove_ports_from_network() function, which was previously
missing this logic entirely. This ensures consistent port creation
and deletion behavior, preventing orphaned neutron ports after
cleaning operations.

Change-Id: I7721f917fb723e8a4cef69e0f7be1ece0238d7ed
Signed-off-by: Milan Fencik <milan.fencik@rackspace.co.uk>
This commit is contained in:
Milan Fencik 2025-12-15 17:46:25 +00:00
parent 4bef17b9bc
commit 9e47609f00
3 changed files with 15 additions and 3 deletions

View file

@ -489,7 +489,8 @@ def remove_ports_from_network(task, network_uuid):
:param network_uuid: UUID of a neutron network ports will be deleted from.
:raises: NetworkError
"""
add_all_ports = CONF.neutron.add_all_ports
pxe_capability = 'pxe_boot' in task.driver.boot.capabilities
add_all_ports = CONF.neutron.add_all_ports or not pxe_capability
if not add_all_ports:
macs = [p.address for p in task.ports if p.pxe_enabled]
else:

View file

@ -25,7 +25,9 @@ class iPXEBoot(pxe_base.PXEBaseMixin, base.BootInterface):
ipxe_enabled = True
capabilities = ['iscsi_volume_boot', 'ramdisk_boot', 'ipxe_boot']
capabilities = [
'iscsi_volume_boot', 'ramdisk_boot', 'ipxe_boot', 'pxe_boot'
]
def __init__(self):
pxe_utils.create_ipxe_boot_script()
@ -40,7 +42,9 @@ class iPXEHttpBoot(pxe_base.PXEBaseMixin, base.BootInterface):
http_boot_enabled = True
capabilities = ['iscsi_volume_boot', 'ramdisk_boot', 'ipxe_boot']
capabilities = [
'iscsi_volume_boot', 'ramdisk_boot', 'ipxe_boot', 'pxe_boot'
]
def __init__(self):
pxe_utils.create_ipxe_boot_script()

View file

@ -0,0 +1,7 @@
---
fixes:
- |
Fixed iPXE boot interfaces (``ipxe`` and ``http-ipxe``) not being
recognized as PXE-capable by the neutron network interface. This
resolves inconsistent neutron port creation and deletion during
cleaning operations that could lead to orphaned neutron ports.