Package ganeti :: Module mcpu
[hide private]
[frames] | no frames]

Module mcpu

source code

Module implementing the logic behind the cluster operations

This module implements the logic for doing operations in the cluster. There are two kinds of classes defined:

Classes [hide private]
  LockAcquireTimeout
Exception to report timeouts on acquiring locks.
  LockAttemptTimeoutStrategy
Class with lock acquire timeout strategy.
  OpExecCbBase
Base class for OpCode execution callbacks.
  Processor
Object which runs OpCodes
Functions [hide private]
 
_CalculateLockAttemptTimeouts()
Calculate timeouts for lock attempts.
source code
 
_LUNameForOpName(opname)
Computes the LU name for a given OpCode name.
source code
 
_ComputeDispatchTable()
Computes the opcode-to-lu dispatch table.
source code
 
_SetBaseOpParams(src, defcomment, dst)
Copies basic opcode parameters.
source code
 
_ProcessResult(submit_fn, op, result)
Examines opcode result.
source code
 
_FailingSubmitManyJobs(_)
Implementation of OpExecCbBase.SubmitManyJobs to raise an exception.
source code
 
_VerifyLocks(lu, _mode_whitelist=_NODE_ALLOC_MODE_WHITELIST, _nal_whitelist=_NODE_ALLOC_WHITELIST)
Performs consistency checks on locks acquired by a logical unit.
source code
a list of strings
_LockList(names)
If 'names' is a string, make it a single-element list.
source code
Variables [hide private]
  sighupReceived = [False]
  lusExecuting = [0]
  _OP_PREFIX = "Op"
  _LU_PREFIX = "LU"
  _NODE_ALLOC_WHITELIST = frozenset([])
LU classes which don't need to acquire the node allocation lock (locking.NAL) when they acquire all node or node resource locks
  _NODE_ALLOC_MODE_WHITELIST = compat.UniqueFrozenset([cmdlib.LU...
LU classes which don't need to acquire the node allocation lock (locking.NAL) in the same mode (shared/exclusive) as the node or node resource locks

Imports: sys, logging, random, time, itertools, traceback, opcodes, opcodes_base, constants, errors, hooksmaster, cmdlib, locking, utils, compat, wconfd


Function Details [hide private]

_SetBaseOpParams(src, defcomment, dst)

source code 

Copies basic opcode parameters.

Parameters:
  • src (opcodes.OpCode) - Source opcode
  • defcomment (string) - Comment to specify if not already given
  • dst (opcodes.OpCode) - Destination opcode

_ProcessResult(submit_fn, op, result)

source code 

Examines opcode result.

If necessary, additional processing on the result is done.

_VerifyLocks(lu, _mode_whitelist=_NODE_ALLOC_MODE_WHITELIST, _nal_whitelist=_NODE_ALLOC_WHITELIST)

source code 

Performs consistency checks on locks acquired by a logical unit.

Parameters:

_LockList(names)

source code 

If 'names' is a string, make it a single-element list.

Parameters:
  • names (list or string or NoneType) - Lock names
Returns: a list of strings
if 'names' argument is an iterable, a list of it; if it's a string, make it a one-element list; if locking.ALL_SET, locking.ALL_SET

Variables Details [hide private]

_NODE_ALLOC_MODE_WHITELIST

LU classes which don't need to acquire the node allocation lock (locking.NAL) in the same mode (shared/exclusive) as the node or node resource locks

Value:
compat.UniqueFrozenset([cmdlib.LUBackupExport, cmdlib.LUBackupRemove, \
cmdlib.LUOobCommand,])