class documentation

class Processor(object):

View In Hierarchy

Object which runs OpCodes

Method __init__ Constructor for Processor
Method BuildHooksManager Undocumented
Method ExecOpCode Execute an opcode.
Method GetECId Returns the current execution context ID.
Method Log Forward call to feedback callback function.
Method LogInfo Log an informational message to the logs and the user.
Method LogStep Log a change in LU execution progress.
Method LogWarning Log a warning to the logs and the user.
Constant DISPATCH_TABLE Undocumented
Instance Variable cfg Undocumented
Instance Variable hmclass Undocumented
Instance Variable rpc Undocumented
Instance Variable wconfd Undocumented
Method _AcquireLocks Acquires locks via the Ganeti lock manager.
Method _CheckLocksEnabled Checks if locking is enabled.
Method _CheckLUResult Check the LU result against the contract in the opcode.
Method _ExecLU Logical Unit execution sequence.
Method _LockAndExecLU Execute a Logical Unit, with the needed locks.
Method _RequestAndWait Request locks from WConfD and wait for them to be granted.
Instance Variable _cbs Undocumented
Instance Variable _ec_id Undocumented
Instance Variable _enable_locks Undocumented
Instance Variable _wconfdcontext Undocumented
def __init__(self, context, ec_id, enable_locks=True):

Constructor for Processor

Parameters
context:GanetiContextglobal Ganeti context
ec_id:stringexecution context identifier
enable_locksUndocumented
def BuildHooksManager(self, lu):

Undocumented

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

Execute an opcode.

Parameters
op:an OpCode instancethe opcode to be executed
cbs:OpExecCbBaseRuntime callbacks
timeout:float or NoneMaximum time to acquire all locks, None for no timeout
Raises
LockAcquireTimeoutIn case locks couldn't be acquired in specified amount of time
def GetECId(self):

Returns the current execution context ID.

def Log(self, *args):

Forward call to feedback callback function.

def LogInfo(self, message, *args):

Log an informational message to the logs and the user.

def LogStep(self, current, total, message):

Log a change in LU execution progress.

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

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.

DISPATCH_TABLE =

Undocumented

Value
_ComputeDispatchTable()
cfg =

Undocumented

hmclass =

Undocumented

rpc =

Undocumented

wconfd =

Undocumented

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

Acquires locks via the Ganeti lock manager.

Parameters
level:intLock level
names:list or stringLock names
shared:boolWhether the locks should be acquired in shared mode
opportunistic:boolWhether to acquire opportunistically
timeout:None or floatTimeout for acquiring the locks
opportunistic_countUndocumented
request_only:booldo not acquire the locks, just return the request
Raises
LockAcquireTimeoutIn case locks couldn't be acquired in specified amount of time; in this case, locks still might be acquired or a request pending.
def _CheckLocksEnabled(self):

Checks if locking is enabled.

Raises
errors.ProgrammerErrorIn case locking is not enabled
def _CheckLUResult(self, op, result):

Check the LU result against the contract in the opcode.

def _ExecLU(self, lu):

Logical Unit execution sequence.

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

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.

def _RequestAndWait(self, request, timeout):

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

Parameters
request:listthe lock request to be sent to WConfD
timeout:floatthe time to wait for the request to be granted
Raises
LockAcquireTimeoutIn case locks couldn't be acquired in specified amount of time; in this case, locks still might be acquired or a request pending.
_cbs =

Undocumented

_ec_id =

Undocumented

_enable_locks =

Undocumented

_wconfdcontext =

Undocumented