The watcher.decision_engine.strategy.strategies.basic_consolidation
Module¶
Good server consolidation strategy
Consolidation of VMs is essential to achieve energy optimization in cloud environments such as OpenStack. As VMs are spinned up and/or moved over time, it becomes necessary to migrate VMs among servers to lower the costs. However, migration of VMs introduces runtime overheads and consumes extra energy, thus a good server consolidation strategy should carefully plan for migration in order to both minimize energy consumption and comply to the various SLAs.
This algorithm not only minimizes the overall number of used servers, but also minimizes the number of migrations.
It has been developed only for tests. You must have at least 2 physical compute nodes to run it, so you can easily run it on DevStack. It assumes that live migration is possible on your OpenStack cluster.
-
class
watcher.decision_engine.strategy.strategies.basic_consolidation.
BasicConsolidation
(config, osc=None)[source]¶ Bases:
watcher.decision_engine.strategy.strategies.base.ServerConsolidationBaseStrategy
Basic offline consolidation using live migration
-
calculate_score_instance
(instance)[source]¶ Calculate Score of virtual machine
Parameters: instance – the virtual machine Returns: score
-
calculate_score_node
(node)[source]¶ Calculate the score that represent the utilization level
Parameters: node – ComputeNode
instanceReturns: Score for the given compute node Return type: float
-
calculate_weight
(compute_resource, total_cores_used, total_disk_used, total_memory_used)[source]¶ Calculate weight of every resource
Parameters: - compute_resource –
- total_cores_used –
- total_disk_used –
- total_memory_used –
Returns:
-
check_migration
(source_node, destination_node, instance_to_migrate)[source]¶ Check if the migration is possible
Parameters: - source_node – the current node of the virtual machine
- destination_node – the destination of the virtual machine
- instance_to_migrate – the instance / virtual machine
Returns: True if the there is enough place otherwise false
-
check_threshold
(destination_node, total_cores, total_disk, total_mem)[source]¶ Check threshold
Check the threshold value defined by the ratio of aggregated CPU capacity of VMs on one node to CPU capacity of this node must not exceed the threshold value.
Parameters: - destination_node – the destination of the virtual machine
- total_cores – total cores of the virtual machine
- total_disk – total disk size used by the virtual machine
- total_mem – total memory used by the virtual machine
Returns: True if the threshold is not exceed
-