From 7ce531d3c099e310c81f94328b9bfa20de58699b Mon Sep 17 00:00:00 2001 From: Dan Sneddon Date: Mon, 8 Jun 2015 13:52:54 -0700 Subject: Set primary interface on OVS bonds This change sets one of the member interfaces of a bond as the primary interface, which results in that interface being the active slave. This change adds a step to the apply method in impl_ifcfg which runs 'ovs-appctl bond/set-active-slave ' after bringing up the bond interfaces. This step ensures that the bonds work correctly without LACP switch support. If a member interface on the bond is set as primary, that interface will be used. Co-Authored-By: Dan Prince Change-Id: I795bb3b8ef977f9276bfec062b197c473393942e --- os_net_config/impl_ifcfg.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'os_net_config/impl_ifcfg.py') diff --git a/os_net_config/impl_ifcfg.py b/os_net_config/impl_ifcfg.py index 40a5ff0..daadd52 100644 --- a/os_net_config/impl_ifcfg.py +++ b/os_net_config/impl_ifcfg.py @@ -52,6 +52,7 @@ class IfcfgNetConfig(os_net_config.NetConfig): self.bridge_data = {} self.member_names = {} self.renamed_interfaces = {} + self.bond_primary_ifaces = {} logger.info('Ifcfg net config provider created.') def child_members(self, name): @@ -107,6 +108,9 @@ class IfcfgNetConfig(os_net_config.NetConfig): data += "OVS_OPTIONS=\"%s\"\n" % base_opt.ovs_options ovs_extra.extend(base_opt.ovs_extra) elif isinstance(base_opt, objects.OvsBond): + if base_opt.primary_interface_name: + primary_name = base_opt.primary_interface_name + self.bond_primary_ifaces[base_opt.name] = primary_name data += "DEVICETYPE=ovs\n" data += "TYPE=OVSBond\n" if base_opt.use_dhcp: @@ -212,7 +216,7 @@ class IfcfgNetConfig(os_net_config.NetConfig): def add_bond(self, bond): """Add an OvsBond object to the net config object. - :param bridge: The OvsBond object to add. + :param bond: The OvsBond object to add. """ logger.info('adding bond: %s' % bond.name) data = self._add_common(bond) @@ -301,4 +305,8 @@ class IfcfgNetConfig(os_net_config.NetConfig): for interface in restart_interfaces: self.ifup(interface) + for bond in self.bond_primary_ifaces: + self.ovs_appctl('bond/set-active-slave', bond, + self.bond_primary_ifaces[bond]) + return update_files -- cgit 1.2.3-korg