Package ganeti :: Module opcodes :: Class OpCode
[hide private]
[frames] | no frames]

Class OpCode

source code


Abstract OpCode.

This is the root of the actual OpCode hierarchy. All clases derived from this class should override OP_ID.

Nested Classes [hide private]

Inherited from BaseOpCode: __metaclass__

Instance Methods [hide private]
dict
__getstate__(self)
Specialized getstate for opcodes.
source code
 
Summary(self)
Generates a summary description of this opcode.
source code
 
TinySummary(self)
Generates a compact summary description of the opcode.
source code

Inherited from BaseOpCode: Validate, __init__, __setstate__

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

Class Methods [hide private]
 
LoadOpCode(cls, data)
Generic load opcode method.
source code

Inherited from BaseOpCode: GetAllParams

Inherited from BaseOpCode (private): _all_slots

Class Variables [hide private]
  WITH_LU = True
Boolean that specifies whether this should be included in mcpu's dispatch table
  OP_PARAMS = [("dry_run", None, ht.TMaybeBool, "Run checks only...
List of opcode attributes, the default values they should get if not already defined, and types they must match.
  OP_RESULT = None
Callable to verify opcode result
  OP_DSC_FIELD
The name of a field whose value will be included in the string returned by Summary(); see the docstring of that method for details).
  OP_ID
The ID of this opcode.
Instance Variables [hide private]
  dry_run
Whether the LU should be run in dry-run mode, i.e.
  priority
Opcode priority for queue
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__getstate__(self)

source code 

Specialized getstate for opcodes.

This method adds to the state dictionary the OP_ID of the class, so that on unload we can identify the correct class for instantiating the opcode.

Returns: dict
the state as a dictionary
Overrides: BaseOpCode.__getstate__

LoadOpCode(cls, data)
Class Method

source code 

Generic load opcode method.

The method identifies the correct opcode class from the dict-form by looking for a OP_ID key, if this is not found, or its value is not available in this module as a child of this class, we fail.

Parameters:
  • data (dict) - the serialized opcode

Summary(self)

source code 

Generates a summary description of this opcode.

The summary is the value of the OP_ID attribute (without the "OP_" prefix), plus the value of the OP_DSC_FIELD attribute, if one was defined; this field should allow to easily identify the operation (for an instance creation job, e.g., it would be the instance name).


Class Variable Details [hide private]

OP_PARAMS

List of opcode attributes, the default values they should get if not already defined, and types they must match.
Value:
[("dry_run", None, ht.TMaybeBool, "Run checks only, don't execute"), (\
"debug_level", None, ht.TOr(ht.TNone, ht.TPositiveInt), "Debug level")\
, ("priority", constants.OP_PRIO_DEFAULT, ht.TElemOf(constants.OP_PRIO\
_SUBMIT_VALID), "Opcode priority"), (DEPEND_ATTR, None, _BuildJobDepCh\
eck(True), "Job dependencies; if used through ``SubmitManyJobs`` relat\
ive (negative)" " job IDs can be used; see :doc:`design document <desi\
gn-chained-jobs>`" " for details"), (COMMENT_ATTR, None, ht.TMaybeStri\
ng, "Comment describing the purpose of the opcode"),]

OP_ID

The ID of this opcode. This should be unique amongst all children of this class.

Instance Variable Details [hide private]

dry_run

Whether the LU should be run in dry-run mode, i.e. just the check steps