Configure Trait Based Networking to Plan Networking Related Operations at vif Attach¶
Ironic has a feature called Trait Based Networking (or TBN) that allows operators to configure how a node’s network will be built and attached.
TBN applies to OpenStack installations utilizing Ironic, Neutron, and Nova that want dynamic port scheduling based on networks and flavors chosen by the instance creator.
In order to use this feature, a few steps must be completed.
Enable Trait Based Networking in the ironic-conductor service configuration:
[conductor] # Enables Trait Based Networking, defaults to False enable_trait_based_networking=True
Place a TBN configuration file in the configured location. The default location is:
/etc/ironic/trait_based_networking.yaml.For discussion of the syntax and format of the configuration file refer to Trait Based Networking Configuration File Reference.
The default configuration which ships with Ironic is reproduced below:
CUSTOM_TRAIT_NAME: order: 1 actions: - action: bond_ports filter: port.vendor == 'vendor_string' min_count: 2 CUSTOM_DIRECT_ATTACH_A_PURPLE_TO_STORAGE: actions: - action: attach_port filter: port.vendor == 'purple' && network.name == 'storage' CUSTOM_BOND_PURPLE_BY_2: actions: - action: group_and_attach_ports filter: port.vendor == 'purple' max_count: 2 CUSTOM_BOND_GREEN_STORAGE_TO_STORAGE_BY_2: actions: - action: group_and_attach_ports filter: port.vendor == 'green' && port.category == 'storage' && ( network.name =~ 'storage' || network.tags =~ 'storage' ) max_count: 2 min_count: 2 CUSTOM_USE_PHYSNET_A_OR_B: actions: - action: attach_port filter: port.physical_network == 'fabric_a' && network.tags == 'a' - action: attach_port filter: port.physical_network == 'fabric_b' && network.tags == 'b'
Set desired TBN traits on a node’s
instance_info.traits. Trait names must match exactly for a TBN trait to be applied.
Then, when vif_attach is called, TBN will plan networking operations based
on the node’s instance_info.traits and supplied configured traits. If
planning succeeds, then each network operation will be applied.