ironic.common.neutron.
PHYSNET_PARAM_NAME
= 'provider:physical_network'¶Name of the neutron network API physical network parameter.
ironic.common.neutron.
SEGMENTS_PARAM_NAME
= 'segments'¶Name of the neutron network API segments parameter.
ironic.common.neutron.
add_ports_to_network
(task, network_uuid, security_groups=None)[source]¶Create neutron ports to boot the ramdisk.
Create neutron ports for each pxe_enabled port on task.node to boot 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.
task – a TaskManager instance.
network_uuid – UUID of a neutron network where ports will be created.
security_groups – List of Security Groups UUIDs to be used for network.
NetworkError
a dictionary in the form {port.uuid: neutron_port[‘id’]}
ironic.common.neutron.
get_local_group_information
(task, portgroup)[source]¶Extract the portgroup information.
The information is returned in the form of:
{
'id': portgroup.uuid,
'name': portgroup.name,
'bond_mode': portgroup.mode,
'bond_properties': {
'bond_propertyA': 'valueA',
'bond_propertyB': 'valueB',
}
}
task – a task containing the Node object.
portgroup – Ironic portgroup object to extract data for.
port group information as a dict
ironic.common.neutron.
get_node_portmap
(task)[source]¶Extract the switch port information for the node.
The information is returned in the form of:
{
port.uuid: {
'switch_id': 'abc',
'port_id': 'Po0/1',
'other_llc_key': 'val'
}
}
task – a task containing the Node object.
port information as a dict
ironic.common.neutron.
get_physnets_by_port_uuid
(client, port_uuid)[source]¶Return the set of physical networks associated with a neutron port.
Query the network to which the port is attached and return the set of physical networks associated with the segments in that network.
client – A Neutron client object.
port_uuid – UUID of a Neutron port to query.
A set of physical networks.
NetworkError if the network query fails.
InvalidParameterValue for missing network.
ironic.common.neutron.
is_smartnic_port
(port_data)[source]¶Check that the port is Smart NIC port
port_data – an instance of ironic.objects.port.Port or port data as dict.
A boolean to indicate port as Smart NIC port.
ironic.common.neutron.
remove_neutron_ports
(task, params)[source]¶Deletes the neutron ports matched by params.
task – a TaskManager instance.
params – Dict of params to filter ports.
NetworkError
ironic.common.neutron.
remove_ports_from_network
(task, network_uuid)[source]¶Deletes the neutron ports created for booting the ramdisk.
task – a TaskManager instance.
network_uuid – UUID of a neutron network ports will be deleted from.
NetworkError
ironic.common.neutron.
rollback_ports
(task, network_uuid)[source]¶Attempts to delete any ports created by cleaning/provisioning
Purposefully will not raise any exceptions so error handling can continue.
task – a TaskManager instance.
network_uuid – UUID of a neutron network.
ironic.common.neutron.
unbind_neutron_port
(port_id, client=None, context=None)[source]¶Unbind a neutron port
Remove a neutron port’s binding profile and host ID so that it returns to an unbound state.
port_id – Neutron port ID.
client – Optional a Neutron client object.
context (ironic.common.context.RequestContext) – request context
NetworkError
ironic.common.neutron.
update_neutron_port
(context, port_id, update_body, client=None)[source]¶Undate a neutron port
Uses neutron client from conf client to update a neutron client an unbound state.
context – request context, instance of ironic.common.context.RequestContext
port_id – Neutron port ID.
update_body – Body of update
client – Optional Neutron client
ironic.common.neutron.
update_port_address
(port_id, address, context=None)[source]¶Update a port’s mac address.
port_id – Neutron port id.
address – new MAC address.
context (ironic.common.context.RequestContext) – request context
FailedToUpdateMacOnPort
ironic.common.neutron.
validate_network
(uuid_or_name, net_type='network', context=None)[source]¶Check that the given network is present.
uuid_or_name – network UUID or name
net_type – human-readable network type for error messages
context (ironic.common.context.RequestContext) – request context
network UUID
MissingParameterValue if uuid_or_name is empty
NetworkError on failure to contact Neutron
InvalidParameterValue for missing or duplicated network
ironic.common.neutron.
validate_port_info
(node, port)[source]¶Check that port contains enough information for deploy.
Neutron network interface requires that local_link_information field is filled before we can use this port.
node – Ironic node object.
port – Ironic port object.
True if port info is valid, False otherwise.
ironic.common.neutron.
wait_for_host_agent
(client, host_id, target_state='up')[source]¶Wait for neutron agent to become target state
client – A Neutron client object.
host_id – Agent host_id
target_state – up: wait for up status, down: wait for down status
boolean indicates the agent state matches param value target_state_up.
exception.Invalid if ‘target_state’ is not valid.
exception.NetworkError if host status didn’t match the required status after max retry attempts.
ironic.common.neutron.
wait_for_port_status
(client, port_id, status)[source]¶Wait for port status to be the desired status
client – A Neutron client object.
port_id – Neutron port_id
status – Port’s target status, can be ACTIVE, DOWN … etc.
boolean indicates that the port status matches the required value passed by param status.
InvalidParameterValue if the port does not exist.
exception.NetworkError if port status didn’t match the required status after max retry attempts.
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.