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

Module opcodes

source code

OpCodes module

This module implements the data structures which define the cluster operations - the so-called opcodes.

Every operation which modifies the cluster state is expressed via opcodes.

Classes [hide private]
  _AutoOpParamSlots
Meta class for opcode definitions.
  BaseOpCode
A simple serializable object.
  OpCode
Abstract OpCode.
  OpClusterPostInit
Post cluster initialization.
  OpClusterDestroy
Destroy the cluster.
  OpClusterQuery
Query cluster information.
  OpClusterVerify
Verify the cluster state.
  OpClusterVerifyDisks
Verify the cluster disks.
  OpClusterRepairDiskSizes
Verify the disk sizes of the instances and fixes configuration mimatches.
  OpClusterConfigQuery
Query cluster configuration values.
  OpClusterRename
Rename the cluster.
  OpClusterSetParams
Change the parameters of the cluster.
  OpClusterRedistConf
Force a full push of the cluster configuration.
  OpQuery
Query for resources/items.
  OpQueryFields
Query for available resource/item fields.
  OpOobCommand
Interact with OOB.
  OpNodeRemove
Remove a node.
  OpNodeAdd
Add a node to the cluster.
  OpNodeQuery
Compute the list of nodes.
  OpNodeQueryvols
Get list of volumes on node.
  OpNodeQueryStorage
Get information on storage for node(s).
  OpNodeModifyStorage
Modifies the properies of a storage unit
  OpRepairNodeStorage
Repairs the volume group on a node.
  OpNodeSetParams
Change the parameters of a node.
  OpNodePowercycle
Tries to powercycle a node.
  OpNodeMigrate
Migrate all instances from a node.
  OpNodeEvacStrategy
Compute the evacuation strategy for a list of nodes.
  OpInstanceCreate
Create an instance.
  OpInstanceReinstall
Reinstall an instance's OS.
  OpInstanceRemove
Remove an instance.
  OpInstanceRename
Rename an instance.
  OpInstanceStartup
Startup an instance.
  OpInstanceShutdown
Shutdown an instance.
  OpInstanceReboot
Reboot an instance.
  OpInstanceReplaceDisks
Replace the disks of an instance.
  OpInstanceFailover
Failover an instance.
  OpInstanceMigrate
Migrate an instance.
  OpInstanceMove
Move an instance.
  OpInstanceConsole
Connect to an instance's console.
  OpInstanceActivateDisks
Activate an instance's disks.
  OpInstanceDeactivateDisks
Deactivate an instance's disks.
  OpInstanceRecreateDisks
Deactivate an instance's disks.
  OpInstanceQuery
Compute the list of instances.
  OpInstanceQueryData
Compute the run-time status of instances.
  OpInstanceSetParams
Change the parameters of an instance.
  OpInstanceGrowDisk
Grow a disk of an instance.
  OpGroupAdd
Add a node group to the cluster.
  OpGroupAssignNodes
Assign nodes to a node group.
  OpGroupQuery
Compute the list of node groups.
  OpGroupSetParams
Change the parameters of a node group.
  OpGroupRemove
Remove a node group from the cluster.
  OpGroupRename
Rename a node group in the cluster.
  OpOsDiagnose
Compute the list of guest operating systems.
  OpBackupQuery
Compute the list of exported images.
  OpBackupPrepare
Prepares an instance export.
  OpBackupExport
Export an instance.
  OpBackupRemove
Remove an instance's export.
  OpTagsGet
Returns the tags of the given object.
  OpTagsSearch
Searches the tags in the cluster for a given pattern.
  OpTagsSet
Add a list of tags on a given object.
  OpTagsDel
Remove a list of tags from a given object.
  OpTestDelay
Sleeps for a configured amount of time.
  OpTestAllocator
Allocator framework testing.
  OpTestJqueue
Utility opcode to test some aspects of the job queue.
  OpTestDummy
Utility opcode used by unittests.
Functions [hide private]
string
_NameToId(name)
Convert an opcode class name to an OP_ID.
source code
 
RequireFileStorage()
Checks that file storage is enabled.
source code
 
_CheckDiskTemplate(template)
Ensure a given disk template is valid.
source code
 
_CheckStorageType(storage_type)
Ensure a given storage type is valid.
source code
 
_GetOpList()
Returns list of all defined opcodes.
source code
Variables [hide private]
  _POutputFields = "output_fields", ht.NoDefault, ht.TListOf(ht....
output fields for a query operation
  _PShutdownTimeout = "shutdown_timeout", constants.DEFAULT_SHUT...
the shutdown timeout
  _PForce = "force", False, ht.TBool
the force parameter
  _PInstanceName = "instance_name", ht.NoDefault, ht.TNonEmptySt...
a required instance name (for single-instance LUs)
  _PIgnoreOfflineNodes = "ignore_offline_nodes", False, ht.TBool
Whether to ignore offline nodes
  _PNodeName = "node_name", ht.NoDefault, ht.TNonEmptyString
a required node name (for single-node LUs)
  _PGroupName = "group_name", ht.NoDefault, ht.TNonEmptyString
a required node group name (for single-group LUs)
  _PMigrationMode = "mode", None, ht.TOr(ht.TNone, ht.TElemOf(co...
Migration type (live/non-live)
  _PMigrationLive = "live", None, ht.TMaybeBool
Obsolete 'live' migration mode (boolean)
  _PTagKind = "kind", ht.NoDefault, ht.TElemOf(constants.VALID_T...
Tag type
  _PTags = "tags", ht.NoDefault, ht.TListOf(ht.TNonEmptyString)
List of tag strings
  _PIgnoreConsistency = "ignore_consistency", False, ht.TBool
Ignore consistency
  _PNoRemember = "no_remember", False, ht.TBool
Do not remember instance state changes
  _OPID_RE = re.compile("([a-z])([A-Z])")
OP_ID conversion regular expression
  _PStorageType = "storage_type", ht.NoDefault, _CheckStorageType
Storage type parameter
  OP_MAPPING = dict((v.OP_ID, v) for v in _GetOpList())

Imports: logging, re, constants, errors, ht


Function Details [hide private]

_NameToId(name)

source code 

Convert an opcode class name to an OP_ID.

Parameters:
  • name (string) - the class name, as OpXxxYyy
Returns: string
the name in the OP_XXXX_YYYY format

RequireFileStorage()

source code 

Checks that file storage is enabled.

While it doesn't really fit into this module, utils was deemed too large of a dependency to be imported for just one or two functions.

Raises:

_GetOpList()

source code 

Returns list of all defined opcodes.

Does not eliminate duplicates by OP_ID.


Variables Details [hide private]

_POutputFields

output fields for a query operation

Value:
"output_fields", ht.NoDefault, ht.TListOf(ht.TNonEmptyString)

_PShutdownTimeout

the shutdown timeout

Value:
"shutdown_timeout", constants.DEFAULT_SHUTDOWN_TIMEOUT, ht.TPositiveIn\
t

_PInstanceName

a required instance name (for single-instance LUs)

Value:
"instance_name", ht.NoDefault, ht.TNonEmptyString

_PMigrationMode

Migration type (live/non-live)

Value:
"mode", None, ht.TOr(ht.TNone, ht.TElemOf(constants.HT_MIGRATION_MODES\
))

_PTagKind

Tag type

Value:
"kind", ht.NoDefault, ht.TElemOf(constants.VALID_TAG_TYPES)