The ironic.drivers.modules.network.common Module

class ironic.drivers.modules.network.common.VIFPortIDMixin[source]

Bases: object

get_current_vif(task, p_obj)[source]

Returns the currently used VIF associated with port or portgroup

We are booting the node only in one network at a time, and presence of cleaning_vif_port_id means we’re doing cleaning, of provisioning_vif_port_id - provisioning. Otherwise it’s a tenant network

Parameters:
  • task – A TaskManager instance.
  • p_obj – Ironic port or portgroup object.
Returns:

VIF ID associated with p_obj or None.

port_changed(task, port_obj)[source]

Handle any actions required when a port changes

Parameters:
  • task – a TaskManager instance.
  • port_obj – a changed Port object from the API before it is saved to database.
Raises:

FailedToUpdateDHCPOptOnPort, Conflict

portgroup_changed(task, portgroup_obj)[source]

Handle any actions required when a portgroup changes

Parameters:
  • task – a TaskManager instance.
  • portgroup_obj – a changed Portgroup object from the API before it is saved to database.
Raises:

FailedToUpdateDHCPOptOnPort, Conflict

vif_attach(task, vif_info)[source]

Attach a virtual network interface to a node

Attach a virtual interface to a node. It will use the first free port group. If there are no free port groups, then the first available port (pxe_enabled preferably) is used.

Parameters:
  • task – A TaskManager instance.
  • vif_info – a dictionary of information about a VIF. It must have an ‘id’ key, whose value is a unique identifier for that VIF.
Raises:

NetworkError, VifAlreadyAttached, NoFreePhysicalPorts

vif_detach(task, vif_id)[source]

Detach a virtual network interface from a node

Parameters:
  • task – A TaskManager instance.
  • vif_id – A VIF ID to detach
Raises:

VifNotAttached if VIF not attached.

Raises:

NetworkError: if unbind Neutron port failed.

vif_list(task)[source]

List attached VIF IDs for a node

Parameters:task – A TaskManager instance.
Returns:List of VIF dictionaries, each dictionary will have an ‘id’ entry with the ID of the VIF.