Follow up to Option to send all portgroup data
Clarifies the code in add_ports_to_network() so that it is clear that the ironic ports that are created in neutron are not necessarily all pxe-enabled. Adds more comments to describe the behaviour if non-pxe-enabled ports are created in neutron. Fixes a typo in the corresponding release note. This is a follow up to I8d0f4e28efb05af704839f3b92cb3dfd48d57940. Change-Id: I94ff18bc137401ff4cd316755408c2099bb563cb Story: 2005494
This commit is contained in:
parent
ed5f8a67af
commit
27fc3d0bc1
@ -198,6 +198,10 @@ def add_ports_to_network(task, network_uuid, security_groups=None):
|
|||||||
Create neutron ports for each pxe_enabled port on task.node to boot
|
Create neutron ports for each pxe_enabled port on task.node to boot
|
||||||
the ramdisk.
|
the ramdisk.
|
||||||
|
|
||||||
|
If the config option 'neutron.add_all_ports' is set, neutron ports
|
||||||
|
for non-pxe-enabled ports are also created -- these neutron ports
|
||||||
|
will not have any assigned IP addresses.
|
||||||
|
|
||||||
:param task: a TaskManager instance.
|
:param task: a TaskManager instance.
|
||||||
:param network_uuid: UUID of a neutron network where ports will be
|
:param network_uuid: UUID of a neutron network where ports will be
|
||||||
created.
|
created.
|
||||||
@ -240,14 +244,16 @@ def add_ports_to_network(task, network_uuid, security_groups=None):
|
|||||||
portmap = get_node_portmap(task)
|
portmap = get_node_portmap(task)
|
||||||
|
|
||||||
if not add_all_ports:
|
if not add_all_ports:
|
||||||
pxe_enabled_ports = [p for p in task.ports if p.pxe_enabled]
|
ports_to_create = [p for p in task.ports if p.pxe_enabled]
|
||||||
else:
|
else:
|
||||||
pxe_enabled_ports = task.ports
|
ports_to_create = task.ports
|
||||||
if not pxe_enabled_ports:
|
if not ports_to_create:
|
||||||
|
pxe_enabled = 'PXE-enabled ' if not add_all_ports else ''
|
||||||
raise exception.NetworkError(_(
|
raise exception.NetworkError(_(
|
||||||
"No available PXE-enabled port on node %s.") % node.uuid)
|
"No available %(enabled)sports on node %(node)s.") %
|
||||||
|
{'enabled': pxe_enabled, 'node': node.uuid})
|
||||||
|
|
||||||
for ironic_port in pxe_enabled_ports:
|
for ironic_port in ports_to_create:
|
||||||
# Start with a clean state for each port
|
# Start with a clean state for each port
|
||||||
port_body = copy.deepcopy(body)
|
port_body = copy.deepcopy(body)
|
||||||
# Skip ports that are missing required information for deploy.
|
# Skip ports that are missing required information for deploy.
|
||||||
@ -259,7 +265,7 @@ def add_ports_to_network(task, network_uuid, security_groups=None):
|
|||||||
[portmap[ironic_port.uuid]]}
|
[portmap[ironic_port.uuid]]}
|
||||||
port_body['port']['binding:profile'] = binding_profile
|
port_body['port']['binding:profile'] = binding_profile
|
||||||
|
|
||||||
if add_all_ports and not ironic_port.pxe_enabled:
|
if not ironic_port.pxe_enabled:
|
||||||
LOG.debug("Adding port %(port)s to network %(net)s for "
|
LOG.debug("Adding port %(port)s to network %(net)s for "
|
||||||
"provisioning without an IP allocation.",
|
"provisioning without an IP allocation.",
|
||||||
{'port': ironic_port.uuid,
|
{'port': ironic_port.uuid,
|
||||||
@ -302,11 +308,11 @@ def add_ports_to_network(task, network_uuid, security_groups=None):
|
|||||||
ports[ironic_port.uuid] = port['port']['id']
|
ports[ironic_port.uuid] = port['port']['id']
|
||||||
|
|
||||||
if failures:
|
if failures:
|
||||||
if len(failures) == len(pxe_enabled_ports):
|
if len(failures) == len(ports_to_create):
|
||||||
rollback_ports(task, network_uuid)
|
rollback_ports(task, network_uuid)
|
||||||
raise exception.NetworkError(_(
|
raise exception.NetworkError(_(
|
||||||
"Failed to create neutron ports for any PXE enabled port "
|
"Failed to create neutron ports for node's %(node)s ports "
|
||||||
"on node %s.") % node.uuid)
|
"%(ports)s.") % {'node': node.uuid, 'ports': ports_to_create})
|
||||||
else:
|
else:
|
||||||
LOG.warning("Some errors were encountered when updating "
|
LOG.warning("Some errors were encountered when updating "
|
||||||
"vif_port_id for node %(node)s on "
|
"vif_port_id for node %(node)s on "
|
||||||
|
@ -3,7 +3,7 @@ fixes:
|
|||||||
- |
|
- |
|
||||||
Provides an opt-in fix to change the default port attachment behavior
|
Provides an opt-in fix to change the default port attachment behavior
|
||||||
for deployment and cleaning operations through a new configuration option,
|
for deployment and cleaning operations through a new configuration option,
|
||||||
``[neutron]add_all_ports``. This option causes ironic to transmits all
|
``[neutron]add_all_ports``. This option causes ironic to transmit all
|
||||||
port information to neutron as opposed to only a single physical network
|
port information to neutron as opposed to only a single physical network
|
||||||
port. This enables operators to successfully operate static Port Group
|
port. This enables operators to successfully operate static Port Group
|
||||||
configurations with Neutron ML2 drivers, where previously configuration
|
configurations with Neutron ML2 drivers, where previously configuration
|
||||||
|
Loading…
x
Reference in New Issue
Block a user