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

Disable exec of legacy /etc/network/<scripts> for now because of the

overhead

Ticket: CM-1438
Reviewed By:
Testing Done:

These are executed with shell=True and python subprocess performance
with shell=True sucks. This seems to have improved in python3. Will try
that out next. And also plan to make this controllable via an option.

This reduces time to ifup by half.
This commit is contained in:
roopa
2014-02-20 09:07:55 -08:00
parent fe0a57d355
commit 6bd7fc7466
2 changed files with 16 additions and 16 deletions

View File

@ -28,6 +28,7 @@ class ifupdownMain(ifupdownBase):
WITH_DEPENDS = False
ALL = False
STATE_CHECK = False
COMPAT_EXEC_SCRIPTS = False
# priv flags to mark iface objects
BUILTIN = 0x1

View File

@ -80,30 +80,29 @@ class ifaceScheduler():
ifaceState.from_str(op),
ifaceStatus.SUCCESS)
# execute /etc/network/ scripts
mlist = ifupdownobj.script_ops.get(op)
if not mlist:
return
for mname in mlist:
ifupdownobj.logger.debug('%s: %s : running script %s'
if ifupdownobj.COMPAT_EXEC_SCRIPTS:
# execute /etc/network/ scripts
for mname in ifupdownobj.script_ops.get(op, []):
ifupdownobj.logger.debug('%s: %s : running script %s'
%(ifacename, op, mname))
try:
ifupdownobj.exec_command(mname, cmdenv=cenv)
except Exception, e:
err = 1
ifupdownobj.log_error(str(e))
try:
ifupdownobj.exec_command(mname, cmdenv=cenv)
except Exception, e:
ifupdownobj.log_error(str(e))
@classmethod
def run_iface_ops(cls, ifupdownobj, ifaceobj, ops):
""" Runs all sub operations on an interface """
cenv=None
# For backward compatibility execute scripts with
# environent set
cenv = ifupdownobj.generate_running_env(ifaceobj, ops[0])
if ifupdownobj.COMPAT_EXEC_SCRIPTS:
# For backward compatibility generate env variables
# for attributes
cenv = ifupdownobj.generate_running_env(ifaceobj, ops[0])
# Each sub operation has a module list
[cls.run_iface_op(ifupdownobj, ifaceobj, op, cenv)
for op in ops]
map(lambda op: cls.run_iface_op(ifupdownobj, ifaceobj, op, cenv), ops)
@classmethod
def run_iface_graph(cls, ifupdownobj, ifacename, ops, parent=None,