ironic.common.neutron module

ironic.common.neutron module

class ironic.common.neutron.NeutronNetworkInterfaceMixin[source]

Bases: object

get_cleaning_network_uuid(task)[source]
get_provisioning_network_uuid(task)[source]
get_rescuing_network_uuid(task)[source]
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.

Parameters:
  • 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.
Raises:

NetworkError

Returns:

a dictionary in the form {port.uuid: neutron_port[‘id’]}

ironic.common.neutron.get_client(token=None, context=None)[source]
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',
    }
}
Parameters:
  • task – a task containing the Node object.
  • portgroup – Ironic portgroup object to extract data for.
Returns:

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'
    }
}
Parameters:task – a task containing the Node object.
Returns: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.

Parameters:
  • client – A Neutron client object.
  • port_uuid – UUID of a Neutron port to query.
Returns:

A set of physical networks.

Raises:

NetworkError if the network query fails.

Raises:

InvalidParameterValue for missing network.

ironic.common.neutron.remove_neutron_ports(task, params)[source]

Deletes the neutron ports matched by params.

Parameters:
  • task – a TaskManager instance.
  • params – Dict of params to filter ports.
Raises:

NetworkError

ironic.common.neutron.remove_ports_from_network(task, network_uuid)[source]

Deletes the neutron ports created for booting the ramdisk.

Parameters:
  • task – a TaskManager instance.
  • network_uuid – UUID of a neutron network ports will be deleted from.
Raises:

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.

Parameters:
  • 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.

Parameters:
Raises:

NetworkError

ironic.common.neutron.update_port_address(port_id, address, context=None)[source]

Update a port’s mac address.

Parameters:
Raises:

FailedToUpdateMacOnPort

ironic.common.neutron.validate_network(uuid_or_name, net_type=u'network', context=None)[source]

Check that the given network is present.

Parameters:
Returns:

network UUID

Raises:

MissingParameterValue if uuid_or_name is empty

Raises:

NetworkError on failure to contact Neutron

Raises:

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.

Parameters:
  • node – Ironic node object.
  • port – Ironic port object.
Returns:

True if port info is valid, False otherwise.

Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.