The watcher.decision_engine.strategy.strategies.basic_consolidation Module

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

add_change_service_state(resource_id, state)[source]
add_migration(resource_id, migration_type, source_node, destination_node)[source]
calculate_num_migrations(sorted_instances, node_to_release, sorted_score)[source]
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:nodeComputeNode 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:
  • 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

compute_score_of_nodes()[source]

Calculate score of nodes based on load by VMs

create_migration_instance(mig_instance, mig_source_node, mig_destination_node)[source]

Create migration VM

do_execute()[source]
classmethod get_config_opts()[source]
classmethod get_display_name()[source]
get_instance_cpu_usage(instance)[source]
classmethod get_name()[source]
get_node_cpu_usage(node)[source]
classmethod get_schema()[source]
classmethod get_translatable_display_name()[source]
node_and_instance_score(sorted_scores)[source]

Get List of VMs from node

post_execute()[source]
pre_execute()[source]
unsuccessful_migration_actualization(number_migrations, unsuccessful_migration)[source]
Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.