The watcher.decision_engine.strategy.strategies.vm_workload_consolidation Module

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.

Description

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

Requirements

  • You must have at least 2 physical compute nodes to run this strategy.

Limitations

<None>

Spec URL

https://github.com/openstack/watcher-specs/blob/master/specs/mitaka/implemented/zhaw-load-consolidation.rst

add_action_disable_node(node)[source]

Add an action for node disablity 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_uuid, source_node, destination_node, model)[source]

Add an action for VM migration into the solution.

Parameters:
  • instance_uuid – instance uuid
  • source_node – node object
  • destination_node – node object
  • model – model_root object
Returns:

None

consolidation_phase(model, 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 accomodate the load. In this phase the most cpu utilizied VMs are prioritizied as their load is more difficult to accomodate in the system than less cpu utilizied VMs which can be later used to fill smaller CPU capacity gaps.

Parameters:
  • model – model_root object
  • cc – dictionary containing resource capacity coefficients
disable_unused_nodes(model)[source]

Generate actions for disablity of unused nodes.

Parameters:model – model_root object
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_display_name()[source]
get_instance_utilization(instance_uuid, model, period=3600, aggr='avg')[source]

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

Parameters:
  • instance_uuid – instance object
  • model – model_root object
  • period – seconds
  • aggr – string
Returns:

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

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

Collect cpu, ram and disk capacity of a node.

Parameters:
  • node – node object
  • model – model_root object
Returns:

dict(cpu(cores), ram(MB), disk(B))

get_node_utilization(node, model, period=3600, aggr='avg')[source]

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

Parameters:
  • node – node object
  • model – model_root object
  • period – seconds
  • aggr – string
Returns:

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

get_relative_cluster_utilization(model)[source]

Calculate relative cluster utilization (rcu).

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

get_relative_node_utilization(node, model)[source]

Return relative node utilization (rhu).

Parameters:
  • node – node object
  • model – model_root object
Returns:

{‘cpu’: <0,1>, ‘ram’: <0,1>, ‘disk’: <0,1>}

get_state_str(state)[source]

Get resource state in string format.

Parameters:state – resource state of unknown type
classmethod get_translatable_display_name()[source]
instance_fits(instance_uuid, node, model, cc)[source]

Indicate whether is a node able to accommodate a VM.

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

is_overloaded(node, model, cc)[source]

Indicate whether a node is overloaded.

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

offload_phase(model, 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 generaly 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 accomodate 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:
  • model – model_root object
  • cc – dictionary containing resource capacity coefficients
optimize_solution(model)[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.
Parameters:model – model_root object
post_execute()[source]
pre_execute()[source]

Previous topic

The watcher.decision_engine.strategy.strategies.uniform_airflow Module

Next topic

The watcher.decision_engine.strategy.strategies.workload_balance Module

Project Source

This Page