mirror of
https://github.com/CumulusNetworks/ifupdown2.git
synced 2024-05-06 15:54:50 +00:00
ip batch support for mstp bridges + add support for multiple globs in a
single port expression + cleanup Ticket: CM-1438 Reviewed By: Testing Done: This has left some dead code in. cleanup comming in subsequent patches. ip batch support is not complete. It currently works only for mstpctl bridges. more coming ..
This commit is contained in:
@@ -30,7 +30,7 @@ verbose=
|
||||
|
||||
perf_options() {
|
||||
# At bootup lets set perfmode
|
||||
[ -f /var/run/network/ifstatenew ] && echo -n "" && return
|
||||
[ -f /var/tmp/network/ifstatenew ] && echo -n "" && return
|
||||
|
||||
echo -n "--perfmode"
|
||||
}
|
||||
|
@@ -111,6 +111,9 @@ class ifupdownMain(ifupdownBase):
|
||||
self.WITH_DEPENDS = withdepends
|
||||
self.STATEMANAGER_ENABLE = statemanager_enable
|
||||
self.CACHE = cache
|
||||
|
||||
# Can be used to provide hints for caching
|
||||
self.CACHE_FLAGS = 0x0
|
||||
self._DELETE_DEPENDENT_IFACES_WITH_NOCONFIG = False
|
||||
self.ADDONS_ENABLE = addons_enable
|
||||
|
||||
@@ -478,7 +481,8 @@ class ifupdownMain(ifupdownBase):
|
||||
dryrun=self.DRYRUN,
|
||||
nowait=self.NOWAIT,
|
||||
perfmode=self.PERFMODE,
|
||||
cache=self.CACHE)
|
||||
cache=self.CACHE,
|
||||
cacheflags=self.CACHE_FLAGS)
|
||||
self.modules[mname] = minstance
|
||||
if hasattr(minstance, 'get_modinfo'):
|
||||
self.module_attrs[mname] = minstance.get_modinfo()
|
||||
|
@@ -27,7 +27,6 @@ class ifaceSchedulerFlags():
|
||||
class ifaceScheduler():
|
||||
""" scheduler functions to schedule configuration of interfaces.
|
||||
|
||||
|
||||
supports scheduling of interfaces serially in plain interface list
|
||||
or dependency graph format.
|
||||
"""
|
||||
@@ -58,16 +57,17 @@ class ifaceScheduler():
|
||||
err = 0
|
||||
try:
|
||||
if hasattr(m, 'run'):
|
||||
ifupdownobj.logger.debug('%s: %s : running module %s'
|
||||
%(ifacename, op, mname))
|
||||
msg = ('%s: %s : running module %s' %(ifacename, op, mname))
|
||||
if op == 'query-checkcurr':
|
||||
# Dont check curr if the interface object was
|
||||
# auto generated
|
||||
if (ifaceobj.priv_flags & ifupdownobj.NOCONFIG):
|
||||
continue
|
||||
ifupdownobj.logger.debug(msg)
|
||||
m.run(ifaceobj, op,
|
||||
query_ifaceobj=ifupdownobj.create_n_save_ifaceobjcurr(ifaceobj))
|
||||
else:
|
||||
ifupdownobj.logger.debug(msg)
|
||||
m.run(ifaceobj, op)
|
||||
except Exception, e:
|
||||
err = 1
|
||||
@@ -93,6 +93,12 @@ class ifaceScheduler():
|
||||
@classmethod
|
||||
def run_iface_ops(cls, ifupdownobj, ifaceobj, ops):
|
||||
""" Runs all operations on an interface """
|
||||
ifacename = ifaceobj.get_name()
|
||||
# minor optimization. If operation is 'down', proceed only
|
||||
# if interface exists in the system
|
||||
if 'down' in ops[0] and not ifupdownobj.link_exists(ifacename):
|
||||
ifupdownobj.logger.info('%s: does not exist' %ifacename)
|
||||
return
|
||||
cenv=None
|
||||
if ifupdownobj.COMPAT_EXEC_SCRIPTS:
|
||||
# For backward compatibility generate env variables
|
||||
@@ -109,11 +115,6 @@ class ifaceScheduler():
|
||||
followdependents=True):
|
||||
""" runs interface by traversing all nodes rooted at itself """
|
||||
|
||||
# minor optimization. If operation is 'down', proceed only
|
||||
# if interface exists in the system
|
||||
if 'down' in ops[0] and not ifupdownobj.link_exists(ifacename):
|
||||
ifupdownobj.logger.info('%s: does not exist' %ifacename)
|
||||
return
|
||||
|
||||
# Each ifacename can have a list of iface objects
|
||||
ifaceobjs = ifupdownobj.get_ifaceobjs(ifacename)
|
||||
@@ -179,8 +180,8 @@ class ifaceScheduler():
|
||||
pass
|
||||
else:
|
||||
# Dont bring the iface up if children did not come up
|
||||
ifaceobj.set_state_n_sttaus(ifaceState.NEW,
|
||||
ifacestatus.ERROR)
|
||||
ifaceobj.set_state_n_status(ifaceState.NEW,
|
||||
ifaceStatus.ERROR)
|
||||
raise
|
||||
if order == ifaceSchedulerFlags.POSTORDER:
|
||||
cls.run_iface_ops(ifupdownobj, ifaceobj, ops)
|
||||
|
@@ -31,7 +31,6 @@ class pickling():
|
||||
except:
|
||||
raise
|
||||
|
||||
|
||||
@classmethod
|
||||
def load(cls, filename):
|
||||
with open(filename, 'r') as f:
|
||||
@@ -40,17 +39,18 @@ class pickling():
|
||||
except EOFError: break
|
||||
except: raise
|
||||
|
||||
|
||||
|
||||
class stateManager():
|
||||
|
||||
state_file = '/run/network/ifstatenew'
|
||||
|
||||
state_dir = '/var/tmp/network/'
|
||||
state_filename = 'ifstatenew'
|
||||
|
||||
def __init__(self):
|
||||
self.ifaceobjdict = OrderedDict()
|
||||
self.logger = logging.getLogger('ifupdown.' +
|
||||
self.__class__.__name__)
|
||||
if not os.path.exists(self.state_dir):
|
||||
os.mkdir(self.state_dir)
|
||||
self.state_file = self.state_dir + self.state_filename
|
||||
|
||||
def save_ifaceobj(self, ifaceobj):
|
||||
if self.ifaceobjdict.get(ifaceobj.get_name()) is None:
|
||||
|
Reference in New Issue
Block a user