class documentation

class OpCode(opcodes_base.BaseOpCode):

Known subclasses: ganeti.opcodes.OpBackupExport, ganeti.opcodes.OpBackupPrepare, ganeti.opcodes.OpBackupRemove, ganeti.opcodes.OpClusterActivateMasterIp, ganeti.opcodes.OpClusterConfigQuery, ganeti.opcodes.OpClusterDeactivateMasterIp, ganeti.opcodes.OpClusterDestroy, ganeti.opcodes.OpClusterPostInit, ganeti.opcodes.OpClusterQuery, ganeti.opcodes.OpClusterRedistConf, ganeti.opcodes.OpClusterRename, ganeti.opcodes.OpClusterRenewCrypto, ganeti.opcodes.OpClusterRepairDiskSizes, ganeti.opcodes.OpClusterSetParams, ganeti.opcodes.OpClusterVerify, ganeti.opcodes.OpClusterVerifyConfig, ganeti.opcodes.OpClusterVerifyDisks, ganeti.opcodes.OpClusterVerifyGroup, ganeti.opcodes.OpExtStorageDiagnose, ganeti.opcodes.OpGroupAdd, ganeti.opcodes.OpGroupAssignNodes, ganeti.opcodes.OpGroupEvacuate, ganeti.opcodes.OpGroupRemove, ganeti.opcodes.OpGroupRename, ganeti.opcodes.OpGroupSetParams, ganeti.opcodes.OpGroupVerifyDisks, ganeti.opcodes.OpInstanceActivateDisks, ganeti.opcodes.OpInstanceChangeGroup, ganeti.opcodes.OpInstanceConsole, ganeti.opcodes.OpInstanceCreate, ganeti.opcodes.OpInstanceDeactivateDisks, ganeti.opcodes.OpInstanceFailover, ganeti.opcodes.OpInstanceGrowDisk, ganeti.opcodes.OpInstanceMigrate, ganeti.opcodes.OpInstanceMove, ganeti.opcodes.OpInstanceMultiAllocBase, ganeti.opcodes.OpInstanceQueryData, ganeti.opcodes.OpInstanceReboot, ganeti.opcodes.OpInstanceRecreateDisks, ganeti.opcodes.OpInstanceReinstall, ganeti.opcodes.OpInstanceRemove, ganeti.opcodes.OpInstanceRename, ganeti.opcodes.OpInstanceReplaceDisks, ganeti.opcodes.OpInstanceSetParams, ganeti.opcodes.OpInstanceShutdown, ganeti.opcodes.OpInstanceStartup, ganeti.opcodes.OpNetworkAdd, ganeti.opcodes.OpNetworkConnect, ganeti.opcodes.OpNetworkDisconnect, ganeti.opcodes.OpNetworkRemove, ganeti.opcodes.OpNetworkRename, ganeti.opcodes.OpNetworkSetParams, ganeti.opcodes.OpNodeAdd, ganeti.opcodes.OpNodeEvacuate, ganeti.opcodes.OpNodeMigrate, ganeti.opcodes.OpNodeModifyStorage, ganeti.opcodes.OpNodePowercycle, ganeti.opcodes.OpNodeQueryStorage, ganeti.opcodes.OpNodeQueryvols, ganeti.opcodes.OpNodeRemove, ganeti.opcodes.OpNodeSetParams, ganeti.opcodes.OpOobCommand, ganeti.opcodes.OpOsDiagnose, ganeti.opcodes.OpQuery, ganeti.opcodes.OpQueryFields, ganeti.opcodes.OpRepairNodeStorage, ganeti.opcodes.OpRestrictedCommand, ganeti.opcodes.OpTagsDel, ganeti.opcodes.OpTagsGet, ganeti.opcodes.OpTagsSearch, ganeti.opcodes.OpTagsSet, ganeti.opcodes.OpTestAllocator, ganeti.opcodes.OpTestDelay, ganeti.opcodes.OpTestDummy, ganeti.opcodes.OpTestJqueue, ganeti.opcodes.OpTestOsParams

View In Hierarchy

Abstract OpCode.

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

Class Method LoadOpCode Generic load opcode method.
Method __getstate__ Specialized getstate for opcodes.
Method Summary Generates a summary description of this opcode.
Method TinySummary Generates a compact summary description of the opcode.
Constant OP_PARAMS List of opcode attributes, the default values they should get if not already defined, and types they must match.
Constant OP_RESULT Callable to verify opcode result
Constant WITH_LU Boolean that specifies whether this should be included in mcpu's dispatch table
Class Variable 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).
Class Variable OP_DSC_FORMATTER A callable that should format the OP_DSC_FIELD; if not present, then the field will be simply converted to string
Class Variable OP_ID The ID of this opcode. This should be unique amongst all children of this class.
Instance Variable dry_run Whether the LU should be run in dry-run mode, i.e. just the check steps
Instance Variable priority Opcode priority for queue

Inherited from BaseOpCode:

Class Method GetAllParams Compute list of all parameters for an opcode.
Method __init__ Constructor for BaseOpCode.
Method __setstate__ Generic unserializer.
Method Validate Validate opcode parameters, optionally setting default values.

Inherited from ValidatedSlots (via BaseOpCode):

Class Method GetAllSlots Compute the list of all declared slots for a class.
Class Variable __slots__ Undocumented
@classmethod
def LoadOpCode(cls, data):

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:dictthe serialized opcode
def __getstate__(self):

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
dictthe state as a dictionary
def Summary(self):

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).

def TinySummary(self):

Generates a compact summary description of the opcode.

OP_PARAMS =
overridden in ganeti.opcodes.OpBackupExport, ganeti.opcodes.OpBackupPrepare, ganeti.opcodes.OpBackupRemove, ganeti.opcodes.OpClusterActivateMasterIp, ganeti.opcodes.OpClusterConfigQuery, ganeti.opcodes.OpClusterDeactivateMasterIp, ganeti.opcodes.OpClusterDestroy, ganeti.opcodes.OpClusterPostInit, ganeti.opcodes.OpClusterQuery, ganeti.opcodes.OpClusterRedistConf, ganeti.opcodes.OpClusterRename, ganeti.opcodes.OpClusterRenewCrypto, ganeti.opcodes.OpClusterRepairDiskSizes, ganeti.opcodes.OpClusterSetParams, ganeti.opcodes.OpClusterVerify, ganeti.opcodes.OpClusterVerifyConfig, ganeti.opcodes.OpClusterVerifyDisks, ganeti.opcodes.OpClusterVerifyGroup, ganeti.opcodes.OpExtStorageDiagnose, ganeti.opcodes.OpGroupAdd, ganeti.opcodes.OpGroupAssignNodes, ganeti.opcodes.OpGroupEvacuate, ganeti.opcodes.OpGroupRemove, ganeti.opcodes.OpGroupRename, ganeti.opcodes.OpGroupSetParams, ganeti.opcodes.OpGroupVerifyDisks, ganeti.opcodes.OpInstanceActivateDisks, ganeti.opcodes.OpInstanceChangeGroup, ganeti.opcodes.OpInstanceConsole, ganeti.opcodes.OpInstanceCreate, ganeti.opcodes.OpInstanceDeactivateDisks, ganeti.opcodes.OpInstanceFailover, ganeti.opcodes.OpInstanceGrowDisk, ganeti.opcodes.OpInstanceMigrate, ganeti.opcodes.OpInstanceMove, ganeti.opcodes.OpInstanceMultiAlloc, ganeti.opcodes.OpInstanceQueryData, ganeti.opcodes.OpInstanceReboot, ganeti.opcodes.OpInstanceRecreateDisks, ganeti.opcodes.OpInstanceReinstall, ganeti.opcodes.OpInstanceRemove, ganeti.opcodes.OpInstanceRename, ganeti.opcodes.OpInstanceReplaceDisks, ganeti.opcodes.OpInstanceSetParams, ganeti.opcodes.OpInstanceShutdown, ganeti.opcodes.OpInstanceStartup, ganeti.opcodes.OpNetworkAdd, ganeti.opcodes.OpNetworkConnect, ganeti.opcodes.OpNetworkDisconnect, ganeti.opcodes.OpNetworkRemove, ganeti.opcodes.OpNetworkRename, ganeti.opcodes.OpNetworkSetParams, ganeti.opcodes.OpNodeAdd, ganeti.opcodes.OpNodeEvacuate, ganeti.opcodes.OpNodeMigrate, ganeti.opcodes.OpNodeModifyStorage, ganeti.opcodes.OpNodePowercycle, ganeti.opcodes.OpNodeQueryStorage, ganeti.opcodes.OpNodeQueryvols, ganeti.opcodes.OpNodeRemove, ganeti.opcodes.OpNodeSetParams, ganeti.opcodes.OpOobCommand, ganeti.opcodes.OpOsDiagnose, ganeti.opcodes.OpQuery, ganeti.opcodes.OpQueryFields, ganeti.opcodes.OpRepairNodeStorage, ganeti.opcodes.OpRestrictedCommand, ganeti.opcodes.OpTagsDel, ganeti.opcodes.OpTagsGet, ganeti.opcodes.OpTagsSearch, ganeti.opcodes.OpTagsSet, ganeti.opcodes.OpTestAllocator, ganeti.opcodes.OpTestDelay, ganeti.opcodes.OpTestDummy, ganeti.opcodes.OpTestJqueue, ganeti.opcodes.OpTestOsParams

List of opcode attributes, the default values they should get if not already defined, and types they must match.

Value
[('dry_run', None, ht.TMaybe(ht.TBool), 'Run checks only, don\'t execute'),
 ('debug_level', None, ht.TMaybe(ht.TNonNegative(ht.TInt)), 'Debug level'),
 ('priority',
  constants.OP_PRIO_DEFAULT,
  ht.TElemOf(constants.OP_PRIO_SUBMIT_VALID),
  'Opcode priority'),
 (opcodes_base.DEPEND_ATTR, None, opcodes_base.BuildJobDepCheck(True), 'Job depe
...
WITH_LU: bool =

Boolean that specifies whether this should be included in mcpu's dispatch table

Value
True
OP_DSC_FIELD =
overridden in ganeti.opcodes.OpBackupExport, ganeti.opcodes.OpBackupPrepare, ganeti.opcodes.OpBackupRemove, ganeti.opcodes.OpClusterRename, ganeti.opcodes.OpClusterVerifyGroup, ganeti.opcodes.OpGroupAdd, ganeti.opcodes.OpGroupAssignNodes, ganeti.opcodes.OpGroupEvacuate, ganeti.opcodes.OpGroupRemove, ganeti.opcodes.OpGroupSetParams, ganeti.opcodes.OpGroupVerifyDisks, ganeti.opcodes.OpInstanceActivateDisks, ganeti.opcodes.OpInstanceChangeGroup, ganeti.opcodes.OpInstanceConsole, ganeti.opcodes.OpInstanceCreate, ganeti.opcodes.OpInstanceDeactivateDisks, ganeti.opcodes.OpInstanceFailover, ganeti.opcodes.OpInstanceGrowDisk, ganeti.opcodes.OpInstanceMigrate, ganeti.opcodes.OpInstanceMove, ganeti.opcodes.OpInstanceReboot, ganeti.opcodes.OpInstanceRecreateDisks, ganeti.opcodes.OpInstanceReinstall, ganeti.opcodes.OpInstanceRemove, ganeti.opcodes.OpInstanceReplaceDisks, ganeti.opcodes.OpInstanceSetParams, ganeti.opcodes.OpInstanceShutdown, ganeti.opcodes.OpInstanceStartup, ganeti.opcodes.OpNetworkAdd, ganeti.opcodes.OpNetworkConnect, ganeti.opcodes.OpNetworkDisconnect, ganeti.opcodes.OpNetworkRemove, ganeti.opcodes.OpNetworkSetParams, ganeti.opcodes.OpNodeAdd, ganeti.opcodes.OpNodeEvacuate, ganeti.opcodes.OpNodeMigrate, ganeti.opcodes.OpNodeModifyStorage, ganeti.opcodes.OpNodePowercycle, ganeti.opcodes.OpNodeRemove, ganeti.opcodes.OpNodeSetParams, ganeti.opcodes.OpQuery, ganeti.opcodes.OpQueryFields, ganeti.opcodes.OpRepairNodeStorage, ganeti.opcodes.OpTagsGet, ganeti.opcodes.OpTagsSearch, ganeti.opcodes.OpTestAllocator, ganeti.opcodes.OpTestDelay

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_DSC_FORMATTER =

A callable that should format the OP_DSC_FIELD; if not present, then the field will be simply converted to string

OP_ID =

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

dry_run =

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

priority =

Opcode priority for queue