Update Server Consolidation global efficacy
As instance migration cost is petty compared to the cost of compute node release, I update the way to compute the global efficacy for a server consolidation goal. The new formula is simplest and it's only based on compute node. Change-Id: Ibcce31a85af70429f412c96c584a761d681366a2
This commit is contained in:
@@ -104,6 +104,20 @@ class MigrationEfficacy(IndicatorSpecification):
|
||||
voluptuous.Range(min=0, max=100), required=True)
|
||||
|
||||
|
||||
class ComputeNodesCount(IndicatorSpecification):
|
||||
def __init__(self):
|
||||
super(ComputeNodesCount, self).__init__(
|
||||
name="compute_nodes_count",
|
||||
description=_("The total number of enabled compute nodes."),
|
||||
unit=None,
|
||||
)
|
||||
|
||||
@property
|
||||
def schema(self):
|
||||
return voluptuous.Schema(
|
||||
voluptuous.Range(min=0), required=True)
|
||||
|
||||
|
||||
class ReleasedComputeNodesCount(IndicatorSpecification):
|
||||
def __init__(self):
|
||||
super(ReleasedComputeNodesCount, self).__init__(
|
||||
|
||||
@@ -33,20 +33,21 @@ class ServerConsolidation(base.EfficacySpecification):
|
||||
|
||||
def get_indicators_specifications(self):
|
||||
return [
|
||||
indicators.ComputeNodesCount(),
|
||||
indicators.ReleasedComputeNodesCount(),
|
||||
indicators.InstanceMigrationsCount(),
|
||||
]
|
||||
|
||||
def get_global_efficacy_indicator(self, indicators_map=None):
|
||||
value = 0
|
||||
if indicators_map and indicators_map.instance_migrations_count > 0:
|
||||
if indicators_map and indicators_map.compute_nodes_count > 0:
|
||||
value = (float(indicators_map.released_compute_nodes_count) /
|
||||
float(indicators_map.instance_migrations_count)) * 100
|
||||
float(indicators_map.compute_nodes_count)) * 100
|
||||
|
||||
return efficacy.Indicator(
|
||||
name="released_nodes_ratio",
|
||||
description=_("Ratio of released compute nodes divided by the "
|
||||
"number of VM migrations."),
|
||||
"total number of enabled compute nodes."),
|
||||
unit='%',
|
||||
value=value,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user