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

Fix a few ordering issues + fix following upperiface for bridge device

Ticket: CM-3346
Reviewed By:
Testing Done: sanity test
This commit is contained in:
Roopa Prabhu
2014-10-10 14:05:19 -07:00
parent 667d62f587
commit 8c13865cd4
3 changed files with 23 additions and 6 deletions

View File

@ -1,11 +1,11 @@
pre-up,ifenslave
pre-up,bridge
pre-up,bridgevlanaware
pre-up,mstpctl
pre-up,vlan
pre-up,vxlan
pre-up,usercmds
pre-up,loopback
pre-up,bridgevlanaware
pre-up,bridge
pre-up,mstpctl
up,dhcp
up,address
up,addressvirtual
@ -18,9 +18,9 @@ down,dhcp
down,addressvirtual
down,address
down,usercmds
post-down,mstpctl
post-down,bridgevlanaware
post-down,bridge
post-down,mstpctl
post-down,vxlan
post-down,vlan
post-down,ifenslave

View File

@ -197,6 +197,20 @@ class ifupdownMain(ifupdownBase):
def get_iface_obj_last(self, ifacename):
return self.ifaceobjdict.get(ifacename)[-1]
def must_follow_upperifaces(self, ifacename):
#
# XXX: This bleeds the knowledge of iface
# types in the infrastructure module.
# Cant think of a better fix at the moment.
# In future maybe the module can set a flag
# to indicate if we should follow upperifaces
#
ifaceobj = self.get_ifaceobj_first(ifacename)
if (ifaceobj.type == ifaceType.BRIDGE or
ifaceobj.type == ifaceType.BRIDGE_VLAN):
return False
return True
def create_n_save_ifaceobj(self, ifacename, priv_flags=None,
increfcnt=False):
""" creates a iface object and adds it to the iface dictionary """

View File

@ -99,6 +99,7 @@ class ifaceScheduler():
# minor optimization. If operation is 'down', proceed only
# if interface exists in the system
ifacename = ifaceobjs[0].name
ifupdownobj.logger.info('%s: running ops ...' %ifacename)
if ('down' in ops[0] and ifaceobjs[0].type != ifaceType.BRIDGE_VLAN and
not ifupdownobj.link_exists(ifacename)):
ifupdownobj.logger.debug('%s: does not exist' %ifacename)
@ -356,7 +357,7 @@ class ifaceScheduler():
#
# Run any upperifaces if available
#
followupperifaces = []
followupperifaces = False
run_queue = []
skip_ifacesort = int(ifupdownobj.config.get('skip_ifacesort', '0'))
if not skip_ifacesort and not indegrees:
@ -368,7 +369,9 @@ class ifaceScheduler():
# If there is any interface that does exist, maybe it is a
# logical interface and we have to followupperifaces when it
# comes up, so get that list.
followupperifaces = (True if
if any([True for i in ifacenames
if ifupdownobj.must_follow_upperifaces(i)]):
followupperifaces = (True if
[i for i in ifacenames
if not ifupdownobj.link_exists(i)]
else False)