watcher.decision_engine.strategy.strategies.vm_workload_consolidation
Module¶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
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:
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.
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: |
|
---|---|
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 |
---|
do_execute
()[source]¶Execute strategy.
This strategy produces a solution resulting in more efficient utilization of cluster resources using following four phases:
Parameters: | original_model – root_model object |
---|
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 |
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: |
|
---|---|
Returns: | dict(cpu(number of vcpus used), ram(MB used), disk(B used)) |
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_utilization
(node)[source]¶Collect cpu, ram and disk utilization statistics of a node.
Parameters: |
|
---|---|
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>} |
get_schema
()[source]¶Defines a Schema that the input parameters shall comply to
Returns: | A jsonschema format (mandatory default setting) |
---|---|
Return type: | dict |
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.:
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.