The watcher.decision_engine.strategy.strategies.basic_consolidation Module

The watcher.decision_engine.strategy.strategies.basic_consolidation Module

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

add_action_disable_node(resource_id)[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 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]

Strategy execution phase

This phase is where you should put the main logic of your strategy.

get_available_compute_nodes()[source]
classmethod 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
classmethod get_display_name()[source]

The goal display name for the strategy

get_instance_cpu_usage(instance)[source]
classmethod get_name()[source]

The name of the strategy

get_node_cpu_usage(node)[source]
classmethod get_schema()[source]

Defines a Schema that the input parameters shall comply to

Returns:A jsonschema format (mandatory default setting)
Return type:dict
classmethod get_translatable_display_name()[source]

The translatable msgid of the strategy

node_and_instance_score(sorted_scores)[source]

Get List of VMs from node

post_execute()[source]

Post-execution phase

This can be used to compute the global efficacy

pre_execute()[source]

Pre-execution phase

This can be used to fetch some pre-requisites or data.

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.