Add ovn_chassis_mac_map to ExtraConfig role

Note: this patch includes a fix for the standalone role cases where
there OVNMacAddressPorts are not created for the OVNBridgeMappings.

Depends-On: https://review.opendev.org/c/openstack/tripleo-ansible/+/827145

Related-Bug: #1881593

Change-Id: Ia766bda0afd5232c13cd28c8bf9162ad1ed580f4
(cherry picked from commit f2fd2a856e)
This commit is contained in:
Kamil Sambor 2021-10-13 12:15:56 +02:00 committed by Brent Eagles
parent 2e594de84a
commit 4690cab2d4
2 changed files with 22 additions and 9 deletions

View File

@ -627,6 +627,7 @@ resources:
- all_nodes # provided by tripleo-hieradata
- vip_data # provided by tripleo-hieradata
- net_ip_map
- ovn_chassis_mac_map # provided by tripleo_hieradata
- '%{::osfamily}'
# The following are required for compatibility with the Controller role
# where some vendor integrations added hieradata via ExtraConfigPre

View File

@ -635,17 +635,29 @@ resources:
type: json
value:
yaql:
expression: let(physnets => switch(isList($.data.physnets) => $.data.physnets, true => [])) ->
$physnets.zip($.data.macs).toDict($.first(), $.last())
# In cases where OS::TripleO::OVNMacAddressPort is set to OS::Heat::None (ie. standalone),
# the macs will be null resulting in a mapping like { "datacentre" : null}. This isn't
# particularly valid or useful and will cause the ovn_controller to crash. This
# outer yaql expression filters out any of these sorts of mappings. There are probably
# alternative approaches that would also work like deleting entries from the 'macs'
# but I'm wary of breaking up the implied matched ordering between the bridge mappings
# and the ports in the event that nulls and real values might coexist in some weird
# case.
expression: let(macmap=>switch(isDict($.data.macmap) => $.data.macmap, true => {})) -> $macmap.deleteAll($macmap.keys().where($macmap[$] = null))
data:
physnets:
macmap:
yaql:
expression: $.data.select($.split(':').first())
data: {get_param: OVNBridgeMappings}
macs:
yaql:
expression: switch(isDict($.data) => $.data.values(), true => [])
data: {get_attr: [{{server_resource_name}}OVNChassisMacPorts, attributes, mac_address]}
expression: let(physnets => switch(isList($.data.physnets) => $.data.physnets, true => [])) ->
$physnets.zip($.data.macs).toDict($.first(), $.last())
data:
physnets:
yaql:
expression: $.data.select($.split(':').first())
data: {get_param: OVNBridgeMappings}
macs:
yaql:
expression: switch(isDict($.data) => $.data.values(), true => [])
data: {get_attr: [{{server_resource_name}}OVNChassisMacPorts, attributes, mac_address]}
outputs:
ansible_host_vars_map: