watcher.decision_engine.strategy.strategies.basic_consolidation
Module¶watcher.decision_engine.strategy.strategies.basic_consolidation.
BasicConsolidation
(config, osc=None)[source]¶Bases: watcher.decision_engine.strategy.strategies.base.ServerConsolidationBaseStrategy
Good server consolidation strategy
Basic offline consolidation using live migration
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.
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 instance |
---|---|
Returns: | 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: |
|
---|---|
Returns: |
check_migration
(source_node, destination_node, instance_to_migrate)[source]¶Check if the migration is possible
Parameters: |
|
---|---|
Returns: | True if 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: |
|
---|---|
Returns: | True if the threshold is not exceed |
create_migration_instance
(mig_instance, mig_source_node, mig_destination_node)[source]¶Create migration VM
do_execute
()[source]¶Strategy execution phase
This phase is where you should put the main logic of your strategy.
get_config_opts
()[source]¶Defines the configuration options to be associated to this loadable
Returns: | A list of configuration options relative to this Loadable |
---|---|
Return type: | list of oslo_config.cfg.Opt instances |
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.