aboutsummaryrefslogtreecommitdiffstats
path: root/os_net_config/impl_ifcfg.py
diff options
context:
space:
mode:
authorDan Sneddon <dsneddon@redhat.com>2015-06-08 13:52:54 -0700
committerDan Prince <dprince@redhat.com>2015-06-09 12:33:32 -0400
commit7ce531d3c099e310c81f94328b9bfa20de58699b (patch)
tree403316dd351650dcbd90600e992159a71f9c012c /os_net_config/impl_ifcfg.py
parenta4a4c43f92138b7d477c7c944849fc69e3c21ac6 (diff)
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 <bond> <iface>' 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 <dprince@redhat.com> Change-Id: I795bb3b8ef977f9276bfec062b197c473393942e
Diffstat (limited to 'os_net_config/impl_ifcfg.py')
-rw-r--r--os_net_config/impl_ifcfg.py10
1 files changed, 9 insertions, 1 deletions
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