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: else:
logger.info(indent + 'lowerdevs: None') 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: ') logger.info(indent + 'config: ')
config = self.config config = self.config
if config: if config:

View File

@@ -442,6 +442,18 @@ class ifupdownMain(ifupdownBase):
len(ifaceobj.upperifaces) > 1): len(ifaceobj.upperifaces) > 1):
self.logger.warn("misconfig..? bond slave \'%s\' is enslaved to multiple interfaces %s" %(ifaceobj.name, str(ifaceobj.upperifaces))) 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): def preprocess_dependency_list(self, upperifaceobj, dlist, ops):
""" We go through the dependency list and """ We go through the dependency list and
delete or add interfaces from the interfaces dict by delete or add interfaces from the interfaces dict by
@@ -487,12 +499,17 @@ class ifupdownMain(ifupdownBase):
dlist.remove(d) dlist.remove(d)
def preprocess_upperiface(self, lowerifaceobj, ulist, ops): def preprocess_upperiface(self, lowerifaceobj, ulist, ops):
uifacelist = self.get_ifaceobjs(ulist[0]) for u in ulist:
if uifacelist: if (lowerifaceobj.upperifaces and
lowerifaceobj.inc_refcnt() u in lowerifaceobj.upperifaces):
for ui in uifacelist: continue
self._set_iface_role_n_kind(lowerifaceobj, ui) lowerifaceobj.add_to_upperifaces(u)
ui.add_to_lowerifaces(lowerifaceobj.name) uifacelist = self.get_ifaceobjs(u)
if uifacelist:
for ui in uifacelist:
lowerifaceobj.inc_refcnt()
self._set_iface_role_n_kind(lowerifaceobj, ui)
ui.add_to_lowerifaces(lowerifaceobj.name)
def query_lowerifaces(self, ifaceobj, ops, ifacenames, type=None): def query_lowerifaces(self, ifaceobj, ops, ifacenames, type=None):
""" Gets iface dependents by calling into respective modules """ """ Gets iface dependents by calling into respective modules """
@@ -549,7 +566,6 @@ class ifupdownMain(ifupdownBase):
if not ifacenames: if not ifacenames:
ifacenames = self.ifaceobjdict.keys() ifacenames = self.ifaceobjdict.keys()
iqueue = deque(ifacenames) iqueue = deque(ifacenames)
while iqueue: while iqueue:
i = iqueue.popleft() i = iqueue.popleft()
@@ -574,7 +590,6 @@ class ifupdownMain(ifupdownBase):
break break
if ulist: if ulist:
self.preprocess_upperiface(ifaceobj, ulist, ops) self.preprocess_upperiface(ifaceobj, ulist, ops)
ifaceobj.add_to_upperifaces(ulist)
if dependents_processed: if dependents_processed:
continue continue
if dlist: if dlist: