def _ExecLU(self, lu):
    write_count = self.cfg.write_count
    lu.cfg.OutDate()
    lu.CheckPrereq()

    self._hm = self.BuildHooksManager(lu)
    try:
      # Run hooks twice: first for the global hooks, then for the usual hooks.
      self._hm.RunPhase(constants.HOOKS_PHASE_PRE, is_global=True)
      h_results = self._hm.RunPhase(constants.HOOKS_PHASE_PRE)
    except Exception, err:  # pylint: disable=W0703
      # This gives the LU a chance of cleaning up in case of an hooks failure.
      # The type of exception is deliberately broad to be able to react to
      # any kind of failure.
      lu.HooksAbortCallBack(constants.HOOKS_PHASE_PRE, self.Log, err)
      # We re-raise the exception to not alter the behavior of LU handling
      # otherwise.
      raise err
    lu.HooksCallBack(constants.HOOKS_PHASE_PRE, h_results,
                     self.Log, None)

    if getattr(lu.op, "dry_run", False):
      # in this mode, no post-hooks are run, and the config is not
      # written (as it might have been modified by another LU, and we
      # shouldn't do writeout on behalf of other threads
      self.LogInfo("dry-run mode requested, not actually executing"
                   " the operation")
      return lu.dry_run_result

    if self._cbs:
      submit_mj_fn = self._cbs.SubmitManyJobs
    else:
      submit_mj_fn = _FailingSubmitManyJobs

    lusExecuting[0] += 1
    try:
      result = _ProcessResult(submit_mj_fn, lu.op, lu.Exec(self.Log))
      h_results = self._hm.RunPhase(constants.HOOKS_PHASE_POST)
      result = lu.HooksCallBack(constants.HOOKS_PHASE_POST, h_results,
                                self.Log, result)
    finally:
      # FIXME: This needs locks if not lu_class.REQ_BGL
      lusExecuting[0] -= 1
      if write_count != self.cfg.write_count:
        self._hm.RunConfigUpdate()

    return result
Logical Unit execution sequence.
dataset/ETHPy150Open ganeti/ganeti/lib/mcpu.py/Processor._ExecLU