Petr Horáček has uploaded a new change for review. Change subject: hooks: ovs: enable auto-attach mapping ......................................................................
hooks: ovs: enable auto-attach mapping Add Auto-Attach mapping support to OVS hook. I-SID could be defined in engine with custom network property 'ovs_aa_sid'. This is supported only for tagged networks. Change-Id: Ib0eaf7ee8b3f3027154df8f6c30a45d4b45c14e0 Signed-off-by: Petr Horáček <phora...@redhat.com> --- M vdsm_hooks/ovs/ovs_before_network_setup_ovs.py 1 file changed, 27 insertions(+), 0 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/59/51859/1 diff --git a/vdsm_hooks/ovs/ovs_before_network_setup_ovs.py b/vdsm_hooks/ovs/ovs_before_network_setup_ovs.py index 5b291b2..880c028 100644 --- a/vdsm_hooks/ovs/ovs_before_network_setup_ovs.py +++ b/vdsm_hooks/ovs/ovs_before_network_setup_ovs.py @@ -81,6 +81,7 @@ commands.extend(['--', 'add-br', net, BRIDGE_NAME, str(vlan)]) if nic is not None: commands.extend(_add_nic_port(net, nic, nets_by_nic)) + commands.extend(_set_aa_mapping(net, attrs, running_config.networks)) running_config.setNetwork(net, attrs) return commands @@ -106,6 +107,7 @@ elif running_nic != nic: commands.extend(_del_nic_port(net, running_nic, nets_by_nic)) commands.extend(_add_nic_port(net, nic, nets_by_nic)) + commands.extend(_set_aa_mapping(net, attrs, running_config.networks)) running_config.setNetwork(net, attrs) return commands @@ -147,6 +149,29 @@ 'stp_enable=%s' % str(stp).lower()] +def _set_aa_mapping(network, attrs, running_config): + """Handle OVS Auto-Attach mapping""" + command = [] + init_sid = rget(running_config.networks, (network, 'custom', 'ovs_aa_sid')) + init_vlan = rget(running_config.networks, (network, 'vlan')) + sid = rget(attrs, ('custom', 'ovs_aa_sid')) + vlan = attrs.get('vlan') + if init_sid != sid or init_vlan != vlan: + if init_sid is not None: + command.extend(['--', 'del-aa-mapping', network, init_sid, + init_vlan]) + if sid is not None: + interfaces = ( + running_config.bonds.get(attrs['bonding'])['nics'] + if 'bonding' in attrs else [attrs['nic']]) + for interface in interfaces: + command.extend(['--', 'set', 'Interface', interface, + 'lldp:enable=true']) + command.extend(['--', 'add-aa-mapping', network, sid, vlan]) + + return command + + def _get_untagged_net(running_config): for network, attrs in iter_ovs_nets(running_config.networks): if 'vlan' not in attrs: @@ -183,6 +208,8 @@ if untagged_net not in (None, net): raise Exception('Untagged network already defined with name %s' % untagged_net) + if rget(attrs, ('custom', 'ovs_aa_sid')) is not None: + raise Exception('Cannot define aa-mapping on untagged network') if stp and vlan is not None: raise Exception('STP could be set only on untagged networks') -- To view, visit https://gerrit.ovirt.org/51859 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib0eaf7ee8b3f3027154df8f6c30a45d4b45c14e0 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Petr Horáček <phora...@redhat.com> _______________________________________________ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches