diff options
author | Dan Prince <dprince@redhat.com> | 2016-04-05 12:51:37 -0400 |
---|---|---|
committer | Dan Prince <dprince@redhat.com> | 2016-04-05 14:01:39 -0400 |
commit | 5f7a330f8ce82d6109a5ff17048eaf11e244ab88 (patch) | |
tree | 3926f7df5d269852d2bca146c6f66be9a0c599d3 /os_net_config/impl_ifcfg.py | |
parent | 4da6d609bbcd25438a41de87111aed3180a10007 (diff) |
Add MASTER=bond SLAVE=yes to linux bond interfaces
When configuring a linux bond with interfaces we have a bug
(due to a missing unit test) where the interfaces weren't
being configured with MASTER=<bond_name> SLAVE=yes. This
patch adds a unit test to check for the required configuration
and cleans up the logic in impl_ifcfg.py to handle it correctly
by simply checking for the linux_bond_name property which
is already set for us via objects.py.
See also: https://bugzilla.redhat.com/show_bug.cgi?id=1323717
Change-Id: Ic632c52265dcbbe6c0ace782e633a2030ad25e6f
Closes-bug: 1566428
Diffstat (limited to 'os_net_config/impl_ifcfg.py')
-rw-r--r-- | os_net_config/impl_ifcfg.py | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/os_net_config/impl_ifcfg.py b/os_net_config/impl_ifcfg.py index 1142a6e..2172a08 100644 --- a/os_net_config/impl_ifcfg.py +++ b/os_net_config/impl_ifcfg.py @@ -65,7 +65,6 @@ class IfcfgNetConfig(os_net_config.NetConfig): self.linuxbridge_data = {} self.linuxbond_data = {} self.member_names = {} - self.bond_slaves = {} self.renamed_interfaces = {} self.bond_primary_ifaces = {} logger.info('Ifcfg net config provider created.') @@ -102,6 +101,9 @@ class IfcfgNetConfig(os_net_config.NetConfig): data += "TYPE=IVSIntPort\n" elif re.match('\w+\.\d+$', base_opt.name): data += "VLAN=yes\n" + if base_opt.linux_bond_name: + data += "MASTER=%s\n" % base_opt.linux_bond_name + data += "SLAVE=yes\n" if base_opt.ivs_bridge_name: data += "DEVICETYPE=ivs\n" data += "IVS_BRIDGE=%s\n" % base_opt.ivs_bridge_name @@ -171,15 +173,9 @@ class IfcfgNetConfig(os_net_config.NetConfig): if base_opt.members: members = [member.name for member in base_opt.members] self.member_names[base_opt.name] = members - for member in members: - if isinstance(member, objects.Interface): - self.bond_slaves[member] = base_opt.name if base_opt.bonding_options: data += "BONDING_OPTS=\"%s\"\n" % base_opt.bonding_options else: - if base_opt.name in self.bond_slaves: - data += "MASTER=%s\n" % self.bond_slaves[base_opt.name] - data += "SLAVE=yes\n" if base_opt.use_dhcp: data += "BOOTPROTO=dhcp\n" elif not base_opt.addresses: |