Package ganeti :: Package masterd :: Module iallocator :: 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_runner, req)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
same as the result of the node info RPC call
_ComputeClusterDataNodeInfo(self, node_list, cluster_info, hypervisor_name)
Prepare and execute node info call.
source code
 
_ComputeClusterData(self)
Compute the generic allocator input data.
source code
 
_ComputeDynamicNodeData(self, node_cfg, node_data, node_iinfo, i_list, node_results, has_lvm)
Compute global node data.
source code
 
_BuildInputData(self, req)
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(cfg, node_cfg, node_whitelist)
Compute global node data.
source code
integer
_GetAttributeFromHypervisorNodeData(hv_info, node_name, attr)
Extract an attribute from the hypervisor's node information.
source code
4-tuple of integers
_ComputeStorageDataFromSpaceInfo(space_info, node_name, has_lvm)
Extract storage data from node info.
source code
tuple (int, int, int)
_ComputeInstanceMemory(instance_list, node_instances_info, node_uuid, input_mem_free)
Compute memory used by primary instances.
source code
 
_ComputeInstanceData(cfg, cluster_info, i_list)
Compute global instance data.
source code
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, cfg, rpc_runner, req)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

_ComputeClusterDataNodeInfo(self, node_list, cluster_info, hypervisor_name)

source code 

Prepare and execute node info call.

Parameters:
  • node_list (list of strings) - list of nodes' UUIDs
  • cluster_info (objects.Cluster) - the cluster's information from the config
  • hypervisor_name (string) - the hypervisor name
Returns: same as the result of the node info RPC call
the result of the node info RPC call

_ComputeClusterData(self)

source code 

Compute the generic allocator input data.

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

_ComputeBasicNodeData(cfg, node_cfg, node_whitelist)
Static Method

source code 

Compute global node data.

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

_GetAttributeFromHypervisorNodeData(hv_info, node_name, attr)
Static Method

source code 

Extract an attribute from the hypervisor's node information.

This is a helper function to extract data from the hypervisor's information about the node, as part of the result of a node_info query.

Parameters:
  • hv_info (dict of strings) - dictionary of node information from the hypervisor
  • node_name (string) - name of the node
  • attr (string) - key of the attribute in the hv_info dictionary
Returns: integer
the value of the attribute
Raises:

_ComputeStorageDataFromSpaceInfo(space_info, node_name, has_lvm)
Static Method

source code 

Extract storage data from node info.

Parameters:
  • space_info (see result of the RPC call node info) - the storage reporting part of the result of the RPC call node info
  • node_name (string) - the node's name
  • has_lvm (boolean) - whether or not LVM storage information is requested
Returns: 4-tuple of integers
tuple of storage info (total_disk, free_disk, total_spindles, free_spindles)

_ComputeInstanceMemory(instance_list, node_instances_info, node_uuid, input_mem_free)
Static Method

source code 

Compute memory used by primary instances.

Returns: tuple (int, int, int)
A tuple of three integers: 1. the sum of memory used by primary instances on the node (including the ones that are currently down), 2. the sum of memory used by primary instances of the node that are up, 3. the amount of memory that is free on the node considering the current usage of the instances.

_ComputeDynamicNodeData(self, node_cfg, node_data, node_iinfo, i_list, node_results, has_lvm)

source code 

Compute global node data.

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

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