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

Module opcodes_base

source code

OpCodes base module

This module implements part of 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.
Functions [hide private]
array of strings
_NameComponents(name)
Split an opcode class name into its components
source code
string
_NameToId(name)
Convert an opcode class name to an OP_ID.
source code
string
NameToReasonSrc(name, prefix)
Convert an opcode class name to a source string for the reason trail
source code
callable
BuildJobDepCheck(relative)
Builds check for job dependencies (DEPEND_ATTR).
source code
Variables [hide private]
  _OPID_RE = re.compile("([a-z])([A-Z])")
OP_ID conversion regular expression
  SUMMARY_PREFIX = {"CLUSTER_": "C_", "GROUP_": "G_", "NODE_": "...
  DEPEND_ATTR = "depends"
Attribute name for dependencies
  COMMENT_ATTR = "comment"
Attribute name for comment
  TNoRelativeJobDependencies = BuildJobDepCheck(False)

Imports: copy, logging, re, constants, errors, ht, outils


Function Details [hide private]

_NameComponents(name)

source code 

Split an opcode class name into its components

Parameters:
  • name (string) - the class name, as OpXxxYyy
Returns: array of strings
the components of the name

_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

NameToReasonSrc(name, prefix)

source code 

Convert an opcode class name to a source string for the reason trail

Parameters:
  • name (string) - the class name, as OpXxxYyy
  • prefix (string) - the prefix that will be prepended to the opcode name
Returns: string
the name in the OP_XXXX_YYYY format

BuildJobDepCheck(relative)

source code 

Builds check for job dependencies (DEPEND_ATTR).

Parameters:
  • relative (bool) - Whether to accept relative job IDs (negative)
Returns: callable

Variables Details [hide private]

SUMMARY_PREFIX

Value:
{"CLUSTER_": "C_", "GROUP_": "G_", "NODE_": "N_", "INSTANCE_": "I_",}