Package ganeti :: Module cmdlib :: Class IAllocator
[hide private]
[frames] | no frames]

Class IAllocator

source code


IAllocator framework.

An IAllocator instance has three sets of attributes:

Instance Methods [hide private]
 
__init__(self, cfg, rpc, mode, **kwargs)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
_ComputeClusterData(self)
Compute the generic allocator input data.
source code
 
_AddNewInstance(self)
Add new instance data to allocator structure.
source code
 
_AddRelocateInstance(self)
Add relocate instance data to allocator structure.
source code
 
_AddNodeEvacuate(self)
Get data for node-evacuate requests.
source code
 
_AddChangeGroup(self)
Get data for node-evacuate requests.
source code
 
_BuildInputData(self, fn, keydata)
Build input data structures.
source code
 
Run(self, name, validate=True, call_fn=None)
Run an instance allocator and return the results.
source code
 
_ValidateResult(self)
Process the allocator results.
source code

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

Static Methods [hide private]
 
_ComputeNodeGroupData(cfg)
Compute node groups data.
source code
dict
_ComputeBasicNodeData(node_cfg)
Compute global node data.
source code
 
_ComputeDynamicNodeData(node_cfg, node_data, node_iinfo, i_list, node_results)
Compute global node data.
source code
 
_ComputeInstanceData(cluster_info, i_list)
Compute global instance data.
source code
 
_NodesToGroups(node2group, groups, nodes)
Returns a list of unique group names for a list of nodes.
source code
Class Variables [hide private]
  _STRING_LIST = ht.TListOf(ht.TString)
  _JOB_LIST = ht.TListOf(ht.TListOf(ht.TStrictDict(True, False, ...
  _NEVAC_MOVED = ht.TListOf(ht.TAnd(ht.TIsLength(3), ht.TItems([...
  _NEVAC_FAILED = ht.TListOf(ht.TAnd(ht.TIsLength(2), ht.TItems(...
  _NEVAC_RESULT = ht.TAnd(ht.TIsLength(3), ht.TItems([_NEVAC_MOV...
  _MODE_DATA = {constants.IALLOCATOR_MODE_ALLOC:(_AddNewInstance...
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, cfg, rpc, mode, **kwargs)
(Constructor)

source code 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__
(inherited documentation)

_ComputeClusterData(self)

source code 

Compute the generic allocator input data.

This is the data that is independent of the actual operation.

_ComputeBasicNodeData(node_cfg)
Static Method

source code 

Compute global node data.

Returns: dict
a dict of name: (node dict, node config)

_ComputeDynamicNodeData(node_cfg, node_data, node_iinfo, i_list, node_results)
Static Method

source code 

Compute global node data.

Parameters:
  • node_results - the basic node structures as filled from the config

_AddNewInstance(self)

source code 

Add new instance data to allocator structure.

This in combination with _AllocatorGetClusterData will create the correct structure needed as input for the allocator.

The checks for the completeness of the opcode must have already been done.

_AddRelocateInstance(self)

source code 

Add relocate instance data to allocator structure.

This in combination with _IAllocatorGetClusterData will create the correct structure needed as input for the allocator.

The checks for the completeness of the opcode must have already been done.

_ValidateResult(self)

source code 

Process the allocator results.

This will process and if successful save the result in self.out_data and the other parameters.

_NodesToGroups(node2group, groups, nodes)
Static Method

source code 

Returns a list of unique group names for a list of nodes.

Parameters:
  • node2group (dict) - Map from node name to group UUID
  • groups (dict) - Group information
  • nodes (list) - Node names

Class Variable Details [hide private]

_JOB_LIST

Value:
ht.TListOf(ht.TListOf(ht.TStrictDict(True, False, {"OP_ID": ht.TElemOf\
([opcodes.OpInstanceFailover.OP_ID, opcodes.OpInstanceMigrate.OP_ID, o\
pcodes.OpInstanceReplaceDisks.OP_ID])})))

_NEVAC_MOVED

Value:
ht.TListOf(ht.TAnd(ht.TIsLength(3), ht.TItems([ht.TNonEmptyString, ht.\
TNonEmptyString, ht.TListOf(ht.TNonEmptyString),])))

_NEVAC_FAILED

Value:
ht.TListOf(ht.TAnd(ht.TIsLength(2), ht.TItems([ht.TNonEmptyString, ht.\
TMaybeString,])))

_NEVAC_RESULT

Value:
ht.TAnd(ht.TIsLength(3), ht.TItems([_NEVAC_MOVED, _NEVAC_FAILED, _JOB_\
LIST]))

_MODE_DATA

Value:
{constants.IALLOCATOR_MODE_ALLOC:(_AddNewInstance, [("name", ht.TStrin\
g), ("memory", ht.TInt), ("disks", ht.TListOf(ht.TDict)), ("disk_templ\
ate", ht.TString), ("os", ht.TString), ("tags", _STRING_LIST), ("nics"\
, ht.TListOf(ht.TDict)), ("vcpus", ht.TInt), ("hypervisor", ht.TString\
),], ht.TList), constants.IALLOCATOR_MODE_RELOC:(_AddRelocateInstance,\
 [("name", ht.TString), ("relocate_from", _STRING_LIST)], ht.TList), c\
onstants.IALLOCATOR_MODE_NODE_EVAC:(_AddNodeEvacuate, [("instances", _\
STRING_LIST), ("evac_mode", ht.TElemOf(constants.IALLOCATOR_NEVAC_MODE\
...