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

Class Processor

source code


Object which runs OpCodes

Instance Methods [hide private]
 
__init__(self, context, ec_id, enable_locks=True)
Constructor for Processor
source code
 
_CheckLocksEnabled(self)
Checks if locking is enabled.
source code
 
_AcquireLocks(self, level, names, shared, opportunistic, timeout)
Acquires locks via the Ganeti lock manager.
source code
 
_ExecLU(self, lu)
Logical Unit execution sequence.
source code
 
BuildHooksManager(self, lu) source code
 
_LockAndExecLU(self, lu, level, calc_timeout)
Execute a Logical Unit, with the needed locks.
source code
 
_CheckLUResult(self, op, result)
Check the LU result against the contract in the opcode.
source code
 
ExecOpCode(self, op, cbs, timeout=None)
Execute an opcode.
source code
 
Log(self, *args)
Forward call to feedback callback function.
source code
 
LogStep(self, current, total, message)
Log a change in LU execution progress.
source code
 
LogWarning(self, message, *args, **kwargs)
Log a warning to the logs and the user.
source code
 
LogInfo(self, message, *args)
Log an informational message to the logs and the user.
source code
 
GetECId(self)
Returns the current execution context ID.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  DISPATCH_TABLE = _ComputeDispatchTable()
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, context, ec_id, enable_locks=True)
(Constructor)

source code 

Constructor for Processor

Parameters:
  • context (GanetiContext) - global Ganeti context
  • ec_id (string) - execution context identifier
Overrides: object.__init__

_CheckLocksEnabled(self)

source code 

Checks if locking is enabled.

Raises:

_AcquireLocks(self, level, names, shared, opportunistic, timeout)

source code 

Acquires locks via the Ganeti lock manager.

Parameters:
  • level (int) - Lock level
  • names (list or string) - Lock names
  • shared (bool) - Whether the locks should be acquired in shared mode
  • opportunistic (bool) - Whether to acquire opportunistically
  • timeout (None or float) - Timeout for acquiring the locks
Raises:

_LockAndExecLU(self, lu, level, calc_timeout)

source code 

Execute a Logical Unit, with the needed locks.

This is a recursive function that starts locking the given level, and proceeds up, till there are no more locks to acquire. Then it executes the given LU and its opcodes.

ExecOpCode(self, op, cbs, timeout=None)

source code 

Execute an opcode.

Parameters:
  • op (an OpCode instance) - the opcode to be executed
  • cbs (OpExecCbBase) - Runtime callbacks
  • timeout (float or None) - Maximum time to acquire all locks, None for no timeout
Raises:

LogWarning(self, message, *args, **kwargs)

source code 

Log a warning to the logs and the user.

The optional keyword argument is 'hint' and can be used to show a hint to the user (presumably related to the warning). If the message is empty, it will not be printed at all, allowing one to show only a hint.