mirror of
https://github.com/CumulusNetworks/ifupdown2.git
synced 2024-05-06 15:54:50 +00:00
ifreload: fix handling(downing) of builtin interfaces on changes
Ticket: CM-8455 Review: CCR-4181 Testing: tested ifreload on builtin interface change This patch handles removal of builtin interfaces (example swp*.100 below..which dont have iface sections) during a ifreload. {noformat} auto bridge iface bridge bridge-vlan-aware yes bridge-ports swp3.100 swp15.100 {noformat} if user changes swp15.100 to another interface and does a ifreload, before this patch swp15.100 used to be around. This patch makes sure swp15.100 is deleted in the process I had to do some cleanup of flags in the process. I might have added some extra cycles to ifreload. But i dont see an easy way to handle this case.
This commit is contained in:
@@ -47,7 +47,7 @@ class ifaceScheduler():
|
||||
if ifupdownobj.type and ifupdownobj.type != ifaceobj.type:
|
||||
return
|
||||
|
||||
if not ifupdownobj.ADDONS_ENABLE: return
|
||||
if not ifupdownobj.flags.ADDONS_ENABLE: return
|
||||
if op == 'query-checkcurr':
|
||||
query_ifaceobj=ifupdownobj.create_n_save_ifaceobjcurr(ifaceobj)
|
||||
# If not type bridge vlan and the object does not exist,
|
||||
@@ -66,7 +66,8 @@ class ifaceScheduler():
|
||||
if op == 'query-checkcurr':
|
||||
# Dont check curr if the interface object was
|
||||
# auto generated
|
||||
if (ifaceobj.priv_flags & ifupdownobj.NOCONFIG):
|
||||
if (ifaceobj.priv_flags and
|
||||
ifaceobj.priv_flags.NOCONFIG):
|
||||
continue
|
||||
ifupdownobj.logger.debug(msg)
|
||||
m.run(ifaceobj, op, query_ifaceobj,
|
||||
@@ -167,11 +168,14 @@ class ifaceScheduler():
|
||||
if 'down' not in ops[0]:
|
||||
return True
|
||||
|
||||
if (ifupdownobj.flags.SCHED_SKIP_CHECK_UPPERIFACES):
|
||||
return True
|
||||
|
||||
if (ifupdownobj.FORCE or
|
||||
not ifupdownobj.ADDONS_ENABLE or
|
||||
not ifupdownobj.flags.ADDONS_ENABLE or
|
||||
(not ifupdownobj.is_ifaceobj_noconfig(ifaceobj) and
|
||||
ifupdownobj.config.get('warn_on_ifdown', '0') == '0' and
|
||||
not ifupdownobj.ALL)):
|
||||
not ifupdownobj.flags.ALL)):
|
||||
return True
|
||||
|
||||
ulist = ifaceobj.upperifaces
|
||||
@@ -188,7 +192,7 @@ class ifaceScheduler():
|
||||
# return false to the caller to skip this interface
|
||||
for u in tmpulist:
|
||||
if ifupdownobj.link_exists(u):
|
||||
if not ifupdownobj.ALL:
|
||||
if not ifupdownobj.flags.ALL:
|
||||
if ifupdownobj.is_ifaceobj_noconfig(ifaceobj):
|
||||
ifupdownobj.logger.info('%s: skipping interface down,'
|
||||
%ifaceobj.name + ' upperiface %s still around ' %u)
|
||||
@@ -358,8 +362,8 @@ class ifaceScheduler():
|
||||
uifaceobj = ifupdownobj.get_ifaceobj_first(u)
|
||||
if not uifaceobj:
|
||||
continue
|
||||
has_config = not bool(uifaceobj.priv_flags
|
||||
& ifupdownobj.NOCONFIG)
|
||||
has_config = not (uifaceobj.priv_flags and
|
||||
uifaceobj.priv_flags.NOCONFIG)
|
||||
if (((has_config and ifupdownobj.get_ifaceobjs_saved(u)) or
|
||||
not has_config) and (not ifupdownobj.link_exists(u)
|
||||
# Do this always for a bridge. Note that this is
|
||||
@@ -410,7 +414,7 @@ class ifaceScheduler():
|
||||
ifacenames_all_sorted = graph.topological_sort_graphs_all(
|
||||
dependency_graph, indegrees)
|
||||
# if ALL was set, return all interfaces
|
||||
if ifupdownobj.ALL:
|
||||
if ifupdownobj.flags.ALL:
|
||||
return ifacenames_all_sorted
|
||||
|
||||
# else return ifacenames passed as argument in sorted order
|
||||
@@ -467,7 +471,7 @@ class ifaceScheduler():
|
||||
for ifacename in dependency_graph.keys():
|
||||
indegrees[ifacename] = ifupdownobj.get_iface_refcnt(ifacename)
|
||||
|
||||
if not ifupdownobj.ALL:
|
||||
if not ifupdownobj.flags.ALL:
|
||||
if 'up' in ops[0]:
|
||||
# If there is any interface that does not exist, maybe it
|
||||
# is a logical interface and we have to followupperifaces
|
||||
@@ -524,7 +528,7 @@ class ifaceScheduler():
|
||||
|
||||
if (not skipupperifaces and
|
||||
ifupdownobj.config.get('skip_upperifaces', '0') == '0' and
|
||||
((not ifupdownobj.ALL and followdependents) or
|
||||
((not ifupdownobj.flags.ALL and followdependents) or
|
||||
followupperifaces) and
|
||||
'up' in ops[0]):
|
||||
# If user had given a set of interfaces to bring up
|
||||
|
Reference in New Issue
Block a user