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

Dont follow dependents during down of interfaces as part of ifreload

Ticket: CM-5571
Reviewed By:
Testing Done: tested ifreload with example in the bug

ifdown of the bridge svi was following the lowerdev and downing the
bridge. kernel implicitly deletes all svi's on bridge down.
ifup of the bridge usually handles it, but a change done in 2.5.1
was causing it not to. Thinking about this some more, its safe
to not follow dependents on down during a ifreload. This patch does
just that.
This commit is contained in:
Roopa Prabhu
2015-04-03 20:47:06 -07:00
parent acf9264497
commit a4912b996e

View File

@@ -686,7 +686,8 @@ class ifupdownMain(ifupdownBase):
# continue reading # continue reading
pass pass
def _sched_ifaces(self, ifacenames, ops, skipupperifaces=False): def _sched_ifaces(self, ifacenames, ops, skipupperifaces=False,
followdependents=True):
self.logger.debug('scheduling \'%s\' for %s' self.logger.debug('scheduling \'%s\' for %s'
%(str(ops), str(ifacenames))) %(str(ops), str(ifacenames)))
self._pretty_print_ordered_dict('dependency graph', self._pretty_print_ordered_dict('dependency graph',
@@ -696,7 +697,7 @@ class ifupdownMain(ifupdownBase):
order=ifaceSchedulerFlags.INORDER order=ifaceSchedulerFlags.INORDER
if 'down' in ops[0] if 'down' in ops[0]
else ifaceSchedulerFlags.POSTORDER, else ifaceSchedulerFlags.POSTORDER,
followdependents=True if self.WITH_DEPENDS else False, followdependents=followdependents,
skipupperifaces=skipupperifaces) skipupperifaces=skipupperifaces)
def _render_ifacename(self, ifacename): def _render_ifacename(self, ifacename):
@@ -886,7 +887,8 @@ class ifupdownMain(ifupdownBase):
try: try:
self._sched_ifaces(filtered_ifacenames, ops, self._sched_ifaces(filtered_ifacenames, ops,
skipupperifaces=skipupperifaces) skipupperifaces=skipupperifaces,
followdependents=True if self.WITH_DEPENDS else False)
finally: finally:
self._process_delay_admin_state_queue('up') self._process_delay_admin_state_queue('up')
if not self.DRYRUN and self.ADDONS_ENABLE: if not self.DRYRUN and self.ADDONS_ENABLE:
@@ -947,7 +949,8 @@ class ifupdownMain(ifupdownBase):
self.populate_dependency_info(ops) self.populate_dependency_info(ops)
try: try:
self._sched_ifaces(filtered_ifacenames, ops) self._sched_ifaces(filtered_ifacenames, ops,
followdependents=True if self.WITH_DEPENDS else False)
finally: finally:
self._process_delay_admin_state_queue('down') self._process_delay_admin_state_queue('down')
if not self.DRYRUN and self.ADDONS_ENABLE: if not self.DRYRUN and self.ADDONS_ENABLE:
@@ -1011,7 +1014,8 @@ class ifupdownMain(ifupdownBase):
elif ops[0] == 'query-raw': elif ops[0] == 'query-raw':
return self.print_ifaceobjs_raw(filtered_ifacenames) return self.print_ifaceobjs_raw(filtered_ifacenames)
self._sched_ifaces(filtered_ifacenames, ops) self._sched_ifaces(filtered_ifacenames, ops,
followdependents=True if self.WITH_DEPENDS else False)
if ops[0] == 'query-checkcurr': if ops[0] == 'query-checkcurr':
ret = self.print_ifaceobjscurr_pretty(filtered_ifacenames, format) ret = self.print_ifaceobjscurr_pretty(filtered_ifacenames, format)
@@ -1078,7 +1082,8 @@ class ifupdownMain(ifupdownBase):
self.dependency_graph = OrderedDict({}) self.dependency_graph = OrderedDict({})
self.populate_dependency_info(downops, self.populate_dependency_info(downops,
already_up_ifacenames_not_present) already_up_ifacenames_not_present)
self._sched_ifaces(already_up_ifacenames_not_present, downops) self._sched_ifaces(already_up_ifacenames_not_present, downops,
followdependents=True if self.WITH_DEPENDS else False)
else: else:
self.logger.debug('no interfaces to down ..') self.logger.debug('no interfaces to down ..')
@@ -1092,7 +1097,8 @@ class ifupdownMain(ifupdownBase):
return return
self.logger.info('reload: scheduling up on interfaces: %s' self.logger.info('reload: scheduling up on interfaces: %s'
%str(interfaces_to_up)) %str(interfaces_to_up))
self._sched_ifaces(interfaces_to_up, upops) self._sched_ifaces(interfaces_to_up, upops,
followdependents=True if self.WITH_DEPENDS else False)
if self.DRYRUN: if self.DRYRUN:
return return
self._save_state() self._save_state()
@@ -1175,7 +1181,8 @@ class ifupdownMain(ifupdownBase):
# Generate dependency info for old config # Generate dependency info for old config
self.populate_dependency_info(downops, ifacedownlist) self.populate_dependency_info(downops, ifacedownlist)
try: try:
self._sched_ifaces(ifacedownlist, downops) self._sched_ifaces(ifacedownlist, downops,
followdependents=False)
except Exception, e: except Exception, e:
self.logger.error(str(e)) self.logger.error(str(e))
pass pass
@@ -1198,7 +1205,8 @@ class ifupdownMain(ifupdownBase):
self.logger.info('reload: scheduling up on interfaces: %s' self.logger.info('reload: scheduling up on interfaces: %s'
%str(filtered_ifacenames)) %str(filtered_ifacenames))
try: try:
self._sched_ifaces(filtered_ifacenames, upops) self._sched_ifaces(filtered_ifacenames, upops,
followdependents=True if self.WITH_DEPENDS else False)
except Exception, e: except Exception, e:
self.logger.error(str(e)) self.logger.error(str(e))
pass pass