1
0
mirror of https://github.com/CumulusNetworks/ifupdown2.git synced 2024-05-06 15:54:50 +00:00

Add check for shared dependents during building dependency list

Testing Done: Tested with shared slaves in bridge and bonds
(cherry picked from commit 6f990450001d367a775681a29cdce74f862f7848)
(cherry picked from commit 8d9a5107112628ee8434e227dff49a0ef09966ee)
This commit is contained in:
Roopa Prabhu
2015-04-03 21:24:25 -07:00
committed by Sam Tannous
parent 3ac88e1553
commit faaa176eed
4 changed files with 64 additions and 1 deletions

View File

@@ -384,6 +384,27 @@ class ifupdownMain(ifupdownBase):
if not ifaceobj: return True
return self.is_ifaceobj_noconfig(ifaceobj)
def check_shared_dependents(self, ifaceobj, dlist):
""" Check if dlist intersects with any other
interface with slave dependents.
example: bond and bridges.
This function logs such errors """
setdlist = Set(dlist)
for ifacename, ifacedlist in self.dependency_graph.items():
if not ifacedlist:
continue
check_depends = False
iobjs = self.get_ifaceobjs(ifacename)
for i in iobjs:
if (i.dependency_type == ifaceDependencyType.MASTER_SLAVE):
check_depends = True
if check_depends:
common = Set(ifacedlist).intersection(setdlist)
if common:
self.logger.error('iface %s and %s '
%(ifaceobj.name, ifacename) +
'have common dependents %s' %str(list(common)))
def preprocess_dependency_list(self, upperifaceobj, dlist, ops):
""" We go through the dependency list and
delete or add interfaces from the interfaces dict by
@@ -401,6 +422,10 @@ class ifupdownMain(ifupdownBase):
"""
del_list = []
if (upperifaceobj.dependency_type ==
ifaceDependencyType.MASTER_SLAVE):
self.check_shared_dependents(upperifaceobj, dlist)
for d in dlist:
dilist = self.get_ifaceobjs(d)
if not dilist:
@@ -451,6 +476,7 @@ class ifupdownMain(ifupdownBase):
if dlist: ret_dlist.extend(dlist)
return list(set(ret_dlist))
def populate_dependency_info(self, ops, ifacenames=None):
""" recursive function to generate iface dependency info """