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

ifupdownmain: handle more than one upperifaces

Ticket: CM-9595
Reviewed By:
Testing Done: tested with failing vrf config in CM-9595

due to same upperiface getting processed more than once,
there was an unnecessary refcount inc on the lowerdevice.
This patch aborts processing upperiface if already
processed and also adds a new debug function to
dump lower and uppper ifaces of all interfaces in the
file.
This commit is contained in:
Roopa Prabhu
2016-02-29 22:23:24 -08:00
parent 3fcb15febd
commit ccbeedcdf5
2 changed files with 29 additions and 8 deletions

View File

@@ -595,6 +595,12 @@ class iface():
else:
logger.info(indent + 'lowerdevs: None')
d = self.upperifaces
if d:
logger.info(indent + 'upperdevs: %s' %str(d))
else:
logger.info(indent + 'upperdevs: None')
logger.info(indent + 'config: ')
config = self.config
if config:

View File

@@ -442,6 +442,18 @@ class ifupdownMain(ifupdownBase):
len(ifaceobj.upperifaces) > 1):
self.logger.warn("misconfig..? bond slave \'%s\' is enslaved to multiple interfaces %s" %(ifaceobj.name, str(ifaceobj.upperifaces)))
def dump_iface_dependency_info(self):
""" debug funtion to print raw dependency
info - lower and upper devices"""
for ifacename, ifaceobjs in self.ifaceobjdict.iteritems():
iobj = ifaceobjs[0]
self.logger.info("%s: refcnt: %d, lower: %s, upper: %s" %(ifacename,
self.get_iface_refcnt(ifacename),
str(iobj.lowerifaces) if iobj.lowerifaces else [],
str(iobj.upperifaces) if iobj.upperifaces else []))
def preprocess_dependency_list(self, upperifaceobj, dlist, ops):
""" We go through the dependency list and
delete or add interfaces from the interfaces dict by
@@ -487,10 +499,15 @@ class ifupdownMain(ifupdownBase):
dlist.remove(d)
def preprocess_upperiface(self, lowerifaceobj, ulist, ops):
uifacelist = self.get_ifaceobjs(ulist[0])
for u in ulist:
if (lowerifaceobj.upperifaces and
u in lowerifaceobj.upperifaces):
continue
lowerifaceobj.add_to_upperifaces(u)
uifacelist = self.get_ifaceobjs(u)
if uifacelist:
lowerifaceobj.inc_refcnt()
for ui in uifacelist:
lowerifaceobj.inc_refcnt()
self._set_iface_role_n_kind(lowerifaceobj, ui)
ui.add_to_lowerifaces(lowerifaceobj.name)
@@ -549,7 +566,6 @@ class ifupdownMain(ifupdownBase):
if not ifacenames:
ifacenames = self.ifaceobjdict.keys()
iqueue = deque(ifacenames)
while iqueue:
i = iqueue.popleft()
@@ -574,7 +590,6 @@ class ifupdownMain(ifupdownBase):
break
if ulist:
self.preprocess_upperiface(ifaceobj, ulist, ops)
ifaceobj.add_to_upperifaces(ulist)
if dependents_processed:
continue
if dlist: