1
0
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:
Roopa Prabhu
2015-10-02 13:18:03 -07:00
parent a33e94f72b
commit 67cfaeb1cf
3 changed files with 43 additions and 8 deletions

View File

@@ -630,7 +630,7 @@ class bridge(moduleBase):
self.brctlcmd.set_bridgeport_attrs(ifaceobj.name, port,
attrdict)
except Exception, e:
self.log_warn('%s: %s', str(e))
self.log_warn('%s: %s' %(ifaceobj.name, str(e)))
pass
self._set_bridge_vidinfo_compat(ifaceobj)
self._set_bridge_mcqv4src_compat(ifaceobj)

View File

@@ -51,7 +51,12 @@ class graph():
continue
for y in dlist:
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:
Q.append(y)

View File

@@ -196,6 +196,7 @@ class ifupdownMain(ifupdownBase):
self.interfacesfileformat = interfacesfileformat
self.config = config
self.logger.debug(self.config)
self.blacklisted_ifaces_present = False
self.type = ifaceType.UNKNOWN
@@ -502,8 +503,6 @@ class ifupdownMain(ifupdownBase):
ifaceobj = self.get_ifaceobj_first(i)
if not ifaceobj:
continue
if ifaceobj.blacklisted:
continue
dlist = ifaceobj.lowerifaces
if not dlist:
dlist = self.query_dependents(ifaceobj, ops, ifacenames)
@@ -517,6 +516,34 @@ class ifupdownMain(ifupdownBase):
if not self.dependency_graph.get(i):
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):
""" check if object has an attribute that is
restricted to a single object in the system.
@@ -801,6 +828,7 @@ class ifupdownMain(ifupdownBase):
if not ret:
for i in ifaceobjs:
i.blacklisted = True
self.blacklisted_ifaces_present = True
return ret
# Check if interface belongs to the class
# the user is interested in, if not return false
@@ -813,6 +841,7 @@ class ifupdownMain(ifupdownBase):
ret = True
else:
i.blacklisted = True
self.blacklisted_ifaces_present = True
if not ret:
return ret
# If the user has requested auto class, check if the interface
@@ -823,6 +852,7 @@ class ifupdownMain(ifupdownBase):
ret = True
else:
i.blacklisted = True
self.blacklisted_ifaces_present = True
return ret
def _compat_conv_op_to_mode(self, op):