class documentation
class IAllocator(object):
IAllocator framework.
An IAllocator instance has three sets of attributes:
- cfg that is needed to query the cluster
- input data (all members of the _KEYS class attribute are required)
- four buffer attributes (in|out_data|text), that represent the input (to the external script) in text and data structure format, and the output from it, again in two formats
- the result variables from the script (success, info, nodes) for easy usage
Method | __init__ |
Undocumented |
Method |
|
Run an instance allocator and return the results. |
Instance Variable | cfg |
Undocumented |
Instance Variable | in |
Undocumented |
Instance Variable | in |
Undocumented |
Instance Variable | info |
Undocumented |
Instance Variable | out |
Undocumented |
Instance Variable | out |
Undocumented |
Instance Variable | req |
Undocumented |
Instance Variable | result |
Undocumented |
Instance Variable | rpc |
Undocumented |
Instance Variable | success |
Undocumented |
Static Method | _ |
Compute global node data. |
Static Method | _ |
Compute global instance data. |
Static Method | _ |
Compute memory used by primary instances. |
Static Method | _ |
Compute node groups data. |
Static Method | _ |
Extract storage data from node info. |
Static Method | _ |
Extract storage data from node info. |
Static Method | _ |
Extract an attribute from the hypervisor's node information. |
Method | _ |
Build input data structures. |
Method | _ |
Compute the generic allocator input data. |
Method | _ |
Prepare and execute node info call. |
Method | _ |
Compute global node data. |
Method | _ |
Process the allocator results. |
@staticmethod
def _ComputeInstanceMemory(instance_list, node_instances_info, node_uuid, input_mem_free): ¶
def _ComputeInstanceMemory(instance_list, node_instances_info, node_uuid, input_mem_free): ¶
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. |
Extract storage data from node info.
Parameters | |
space | the storage reporting part of the result of the RPC call node info |
node | the node's name |
has | 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) |
@staticmethod
def _ComputeStorageDataFromSpaceInfoByTemplate(space_info, node_name, disk_template): ¶
def _ComputeStorageDataFromSpaceInfoByTemplate(space_info, node_name, disk_template): ¶
Extract storage data from node info.
Parameters | |
space | the storage reporting part of the result of the RPC call node info |
node | the node's name |
disk | the disk template to report space for |
Returns | |
4-tuple of integers | tuple of storage info (total_disk, free_disk, total_spindles, free_spindles) |
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 | dictionary of node information from the hypervisor |
node | name of the node |
attr:string | key of the attribute in the hv_info dictionary |
Returns | |
integer | the value of the attribute |
Raises | |
errors.OpExecError | if key not in dictionary or value not integer |
Compute the generic allocator input data.
Parameters | |
disk | the disk templates of the instances to be allocated |
Prepare and execute node info call.
Parameters | |
disk | the disk templates of the instances to be allocated |
node | list of nodes' UUIDs |
clusterobjects.Cluster | the cluster's information from the config |
hypervisor | the hypervisor name |
Returns | |
same as the result of the node info RPC call | the result of the node info RPC call |
def _ComputeDynamicNodeData(self, node_cfg, node_data, node_iinfo, i_list, node_results, disk_template):
¶
Compute global node data.
Parameters | |
node | Undocumented |
node | Undocumented |
node | Undocumented |
i | Undocumented |
node | the basic node structures as filled from the config |
disk | Undocumented |