The watcher.decision_engine.strategy.strategies.vm_workload_consolidation Module

The watcher.decision_engine.strategy.strategies.vm_workload_consolidation Module

VM Workload Consolidation Strategy

A load consolidation strategy based on heuristic first-fit algorithm which focuses on measured CPU utilization and tries to minimize hosts which have too much or too little load respecting resource capacity constraints.

This strategy produces a solution resulting in more efficient utilization of cluster resources using following four phases:

  • Offload phase - handling over-utilized resources
  • Consolidation phase - handling under-utilized resources
  • Solution optimization - reducing number of migrations
  • Disability of unused compute nodes

A capacity coefficients (cc) might be used to adjust optimization thresholds. Different resources may require different coefficient values as well as setting up different coefficient values in both phases may lead to to more efficient consolidation in the end. If the cc equals 1 the full resource capacity may be used, cc values lower than 1 will lead to resource under utilization and values higher than 1 will lead to resource overbooking. e.g. If targeted utilization is 80 percent of a compute node capacity, the coefficient in the consolidation phase will be 0.8, but may any lower value in the offloading phase. The lower it gets the cluster will appear more released (distributed) for the following consolidation phase.

As this strategy leverages VM live migration to move the load from one compute node to another, this feature needs to be set up correctly on all compute nodes within the cluster. This strategy assumes it is possible to live migrate any VM from an active compute node to any other active compute node.

class watcher.decision_engine.strategy.strategies.vm_workload_consolidation.VMWorkloadConsolidation(config, osc=None)[source]

Bases: watcher.decision_engine.strategy.strategies.base.ServerConsolidationBaseStrategy

VM Workload Consolidation Strategy

add_action_disable_node(node)[source]

Add an action for node disability into the solution.

Parameters:node – node object
Returns:None
add_action_enable_compute_node(node)[source]

Add an action for node enabler into the solution.

Parameters:node – node object
Returns:None
add_migration(instance, source_node, destination_node)[source]

Add an action for VM migration into the solution.

Parameters:
  • instance – instance object
  • source_node – node object
  • destination_node – node object
Returns:

None

consolidation_phase(cc)[source]

Perform consolidation phase.

This considers provided resource capacity coefficients. Consolidation phase performing first-fit based bin packing. First, nodes with the lowest cpu utilization are consolidated by moving their load to nodes with the highest cpu utilization which can accommodate the load. In this phase the most cpu utilized VMs are prioritized as their load is more difficult to accommodate in the system than less cpu utilized VMs which can be later used to fill smaller CPU capacity gaps.

Parameters:cc – dictionary containing resource capacity coefficients
disable_unused_nodes()[source]

Generate actions for disabling unused nodes.

Returns:None
do_execute()[source]

Execute strategy.

This strategy produces a solution resulting in more efficient utilization of cluster resources using following four phases:

  • Offload phase - handling over-utilized resources
  • Consolidation phase - handling under-utilized resources
  • Solution optimization - reducing number of migrations
  • Disability of unused nodes
Parameters:original_model – root_model object
classmethod get_config_opts()[source]
classmethod get_display_name()[source]
get_instance_state_str(instance)[source]

Get instance state in string format.

Parameters:instance
get_instance_utilization(instance)[source]

Collect cpu, ram and disk utilization statistics of a VM.

Parameters:
  • instance – instance object
  • aggr – string
Returns:

dict(cpu(number of vcpus used), ram(MB used), disk(B used))

classmethod get_name()[source]
get_node_capacity(node)[source]

Collect cpu, ram and disk capacity of a node.

Parameters:node – node object
Returns:dict(cpu(cores), ram(MB), disk(B))
get_node_status_str(node)[source]

Get node status in string format.

Parameters:node
get_node_utilization(node)[source]

Collect cpu, ram and disk utilization statistics of a node.

Parameters:
  • node – node object
  • aggr – string
Returns:

dict(cpu(number of cores used), ram(MB used), disk(B used))

get_relative_cluster_utilization()[source]

Calculate relative cluster utilization (rcu).

RCU is an average of relative utilizations (rhu) of active nodes. :return: {‘cpu’: <0,1>, ‘ram’: <0,1>, ‘disk’: <0,1>}

get_relative_node_utilization(node)[source]

Return relative node utilization.

Parameters:node – node object
Returns:{‘cpu’: <0,1>, ‘ram’: <0,1>, ‘disk’: <0,1>}
classmethod get_schema()[source]
classmethod get_translatable_display_name()[source]
instance_fits(instance, node, cc)[source]

Indicate whether is a node able to accommodate a VM.

This considers provided resource capacity coefficients (cc). :param instance: Instance :param node: node object :param cc: dictionary containing resource capacity coefficients :return: [True, False]

is_overloaded(node, cc)[source]

Indicate whether a node is overloaded.

This considers provided resource capacity coefficients (cc). :param node: node object :param cc: dictionary containing resource capacity coefficients :return: [True, False]

offload_phase(cc)[source]

Perform offloading phase.

This considers provided resource capacity coefficients. Offload phase performing first-fit based bin packing to offload overloaded nodes. This is done in a fashion of moving the least CPU utilized VM first as live migration these generally causes less troubles. This phase results in a cluster with no overloaded nodes. * This phase is be able to enable disabled nodes (if needed and any available) in the case of the resource capacity provided by active nodes is not able to accommodate all the load. As the offload phase is later followed by the consolidation phase, the node enabler in this phase doesn’t necessarily results in more enabled nodes in the final solution.

Parameters:cc – dictionary containing resource capacity coefficients
optimize_solution()[source]

Optimize solution.

This is done by eliminating unnecessary or circular set of migrations which can be replaced by a more efficient solution. e.g.:

  • A->B, B->C => replace migrations A->B, B->C with a single migration A->C as both solution result in VM running on node C which can be achieved with one migration instead of two.
  • A->B, B->A => remove A->B and B->A as they do not result in a new VM placement.
post_execute()[source]
pre_execute()[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.