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
 
_RequestAndWait(self, request, timeout)
Request locks from WConfD and wait for them to be granted.
source code
 
_AcquireLocks(self, level, names, shared, opportunistic, timeout, opportunistic_count=1, request_only=False)
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, pending=None)
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:

_RequestAndWait(self, request, timeout)

source code 

Request locks from WConfD and wait for them to be granted.

Parameters:
  • request (list) - the lock request to be sent to WConfD
  • timeout (float) - the time to wait for the request to be granted
Raises:
  • LockAcquireTimeout - In case locks couldn't be acquired in specified amount of time; in this case, locks still might be acquired or a request pending.

_AcquireLocks(self, level, names, shared, opportunistic, timeout, opportunistic_count=1, request_only=False)

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
  • request_only (bool) - do not acquire the locks, just return the request
Raises:
  • LockAcquireTimeout - In case locks couldn't be acquired in specified amount of time; in this case, locks still might be acquired or a request pending.

_LockAndExecLU(self, lu, level, calc_timeout, pending=None)

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.