mirror of
https://github.com/CumulusNetworks/ifupdown2.git
synced 2024-05-06 15:54:50 +00:00
remove blacklisted interfaces only if they are upperifaces (ie root of
the tree) Ticket: CM-7765 Reviewed By: CCR-3621 Testing Done: tested interface dependencies with auto and non-auto interfaces This commit fixes a change in behaviour introduced by "460906d0552d" ("skip adding filtered or blacklisted interfaces in the dependency graph") that skipped non-auto (or blacklisted) interfaces. Turns out we have files out there that do have non-auto dependents. This patch makes sure blacklisted interfaces who are dependents of other interfaces are always picked up.
This commit is contained in:
@@ -630,7 +630,7 @@ class bridge(moduleBase):
|
|||||||
self.brctlcmd.set_bridgeport_attrs(ifaceobj.name, port,
|
self.brctlcmd.set_bridgeport_attrs(ifaceobj.name, port,
|
||||||
attrdict)
|
attrdict)
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
self.log_warn('%s: %s', str(e))
|
self.log_warn('%s: %s' %(ifaceobj.name, str(e)))
|
||||||
pass
|
pass
|
||||||
self._set_bridge_vidinfo_compat(ifaceobj)
|
self._set_bridge_vidinfo_compat(ifaceobj)
|
||||||
self._set_bridge_mcqv4src_compat(ifaceobj)
|
self._set_bridge_mcqv4src_compat(ifaceobj)
|
||||||
|
@@ -51,7 +51,12 @@ class graph():
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
for y in dlist:
|
for y in dlist:
|
||||||
indegrees[y] = indegrees.get(y) - 1
|
try:
|
||||||
|
indegrees[y] = indegrees.get(y) - 1
|
||||||
|
except:
|
||||||
|
self.logger.debug('topological_sort_graphs_all: did not find %s' %y)
|
||||||
|
indegrees[y] = 0
|
||||||
|
pass
|
||||||
if indegrees.get(y) == 0:
|
if indegrees.get(y) == 0:
|
||||||
Q.append(y)
|
Q.append(y)
|
||||||
|
|
||||||
|
@@ -196,6 +196,7 @@ class ifupdownMain(ifupdownBase):
|
|||||||
self.interfacesfileformat = interfacesfileformat
|
self.interfacesfileformat = interfacesfileformat
|
||||||
self.config = config
|
self.config = config
|
||||||
self.logger.debug(self.config)
|
self.logger.debug(self.config)
|
||||||
|
self.blacklisted_ifaces_present = False
|
||||||
|
|
||||||
self.type = ifaceType.UNKNOWN
|
self.type = ifaceType.UNKNOWN
|
||||||
|
|
||||||
@@ -502,8 +503,6 @@ class ifupdownMain(ifupdownBase):
|
|||||||
ifaceobj = self.get_ifaceobj_first(i)
|
ifaceobj = self.get_ifaceobj_first(i)
|
||||||
if not ifaceobj:
|
if not ifaceobj:
|
||||||
continue
|
continue
|
||||||
if ifaceobj.blacklisted:
|
|
||||||
continue
|
|
||||||
dlist = ifaceobj.lowerifaces
|
dlist = ifaceobj.lowerifaces
|
||||||
if not dlist:
|
if not dlist:
|
||||||
dlist = self.query_dependents(ifaceobj, ops, ifacenames)
|
dlist = self.query_dependents(ifaceobj, ops, ifacenames)
|
||||||
@@ -517,6 +516,34 @@ class ifupdownMain(ifupdownBase):
|
|||||||
if not self.dependency_graph.get(i):
|
if not self.dependency_graph.get(i):
|
||||||
self.dependency_graph[i] = dlist
|
self.dependency_graph[i] = dlist
|
||||||
|
|
||||||
|
if not self.blacklisted_ifaces_present:
|
||||||
|
return
|
||||||
|
|
||||||
|
# Walk through the dependency graph and remove blacklisted
|
||||||
|
# interfaces that were picked up as dependents
|
||||||
|
for i in self.dependency_graph.keys():
|
||||||
|
ifaceobj = self.get_ifaceobj_first(i)
|
||||||
|
if not ifaceobj:
|
||||||
|
continue
|
||||||
|
if ifaceobj.blacklisted and not ifaceobj.upperifaces:
|
||||||
|
# if blacklisted and was not picked up as a
|
||||||
|
# dependent of a upper interface, delete the
|
||||||
|
# interface from the dependency graph
|
||||||
|
dlist = ifaceobj.lowerifaces
|
||||||
|
if dlist:
|
||||||
|
for d in dlist:
|
||||||
|
difaceobj = self.get_ifaceobj_first(d)
|
||||||
|
if not difaceobj:
|
||||||
|
continue
|
||||||
|
difaceobj.dec_refcnt()
|
||||||
|
try:
|
||||||
|
difaceobj.upperifaces.remove(i)
|
||||||
|
except:
|
||||||
|
self.logger.debug('error removing %s from %s upperifaces' %(i, d))
|
||||||
|
pass
|
||||||
|
self.logger.debug("populate_dependency_info: deleting blacklisted interface %s" %i)
|
||||||
|
del self.dependency_graph[i]
|
||||||
|
|
||||||
def _check_config_no_repeats(self, ifaceobj):
|
def _check_config_no_repeats(self, ifaceobj):
|
||||||
""" check if object has an attribute that is
|
""" check if object has an attribute that is
|
||||||
restricted to a single object in the system.
|
restricted to a single object in the system.
|
||||||
@@ -797,13 +824,14 @@ class ifupdownMain(ifupdownBase):
|
|||||||
if ret:
|
if ret:
|
||||||
self.logger.debug('iface %s' %ifacename + ' not found')
|
self.logger.debug('iface %s' %ifacename + ' not found')
|
||||||
return ret
|
return ret
|
||||||
# If matched exclude pattern, return false
|
# If matched exclude pattern, return false
|
||||||
if not ret:
|
if not ret:
|
||||||
for i in ifaceobjs:
|
for i in ifaceobjs:
|
||||||
i.blacklisted = True
|
i.blacklisted = True
|
||||||
|
self.blacklisted_ifaces_present = True
|
||||||
return ret
|
return ret
|
||||||
# Check if interface belongs to the class
|
# Check if interface belongs to the class
|
||||||
# the user is interested in, if not return false
|
# the user is interested in, if not return false
|
||||||
if allow_classes:
|
if allow_classes:
|
||||||
for i in ifaceobjs:
|
for i in ifaceobjs:
|
||||||
if i.classes:
|
if i.classes:
|
||||||
@@ -813,16 +841,18 @@ class ifupdownMain(ifupdownBase):
|
|||||||
ret = True
|
ret = True
|
||||||
else:
|
else:
|
||||||
i.blacklisted = True
|
i.blacklisted = True
|
||||||
|
self.blacklisted_ifaces_present = True
|
||||||
if not ret:
|
if not ret:
|
||||||
return ret
|
return ret
|
||||||
# If the user has requested auto class, check if the interface
|
# If the user has requested auto class, check if the interface
|
||||||
# is marked auto
|
# is marked auto
|
||||||
if auto:
|
if auto:
|
||||||
for i in ifaceobjs:
|
for i in ifaceobjs:
|
||||||
if i.auto:
|
if i.auto:
|
||||||
ret = True
|
ret = True
|
||||||
else:
|
else:
|
||||||
i.blacklisted = True
|
i.blacklisted = True
|
||||||
|
self.blacklisted_ifaces_present = True
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
def _compat_conv_op_to_mode(self, op):
|
def _compat_conv_op_to_mode(self, op):
|
||||||
|
Reference in New Issue
Block a user