Add efficacy indicators for workload_stabilization strategy
This patch set adds efficacy indicators for workload_balancing goal (that includes workload_stabilization and workload_balance strategies so far). Change-Id: I5b04d084ace7c661001c62f07b8308e5763e144d
This commit is contained in:
@@ -72,7 +72,8 @@ class EfficacySpecification(object):
|
||||
}
|
||||
for indicator in self.indicators_specs:
|
||||
schema["properties"][indicator.name] = indicator.schema
|
||||
schema["required"].append(indicator.name)
|
||||
if indicator.required:
|
||||
schema["required"].append(indicator.name)
|
||||
return schema
|
||||
|
||||
def validate_efficacy_indicators(self, indicators_map):
|
||||
|
||||
@@ -90,7 +90,7 @@ class ComputeNodesCount(IndicatorSpecification):
|
||||
return {
|
||||
"type": "integer",
|
||||
"minimum": 0
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class ReleasedComputeNodesCount(IndicatorSpecification):
|
||||
@@ -106,7 +106,25 @@ class ReleasedComputeNodesCount(IndicatorSpecification):
|
||||
return {
|
||||
"type": "integer",
|
||||
"minimum": 0
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class InstancesCount(IndicatorSpecification):
|
||||
def __init__(self):
|
||||
super(InstancesCount, self).__init__(
|
||||
name="instances_count",
|
||||
description=_("The total number of audited instances in "
|
||||
"strategy."),
|
||||
unit=None,
|
||||
required=False,
|
||||
)
|
||||
|
||||
@property
|
||||
def schema(self):
|
||||
return {
|
||||
"type": "integer",
|
||||
"minimum": 0
|
||||
}
|
||||
|
||||
|
||||
class InstanceMigrationsCount(IndicatorSpecification):
|
||||
@@ -122,7 +140,7 @@ class InstanceMigrationsCount(IndicatorSpecification):
|
||||
return {
|
||||
"type": "integer",
|
||||
"minimum": 0
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class LiveInstanceMigrateCount(IndicatorSpecification):
|
||||
@@ -138,7 +156,7 @@ class LiveInstanceMigrateCount(IndicatorSpecification):
|
||||
return {
|
||||
"type": "integer",
|
||||
"minimum": 0
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class PlannedLiveInstanceMigrateCount(IndicatorSpecification):
|
||||
@@ -154,7 +172,7 @@ class PlannedLiveInstanceMigrateCount(IndicatorSpecification):
|
||||
return {
|
||||
"type": "integer",
|
||||
"minimum": 0
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class ColdInstanceMigrateCount(IndicatorSpecification):
|
||||
@@ -170,7 +188,7 @@ class ColdInstanceMigrateCount(IndicatorSpecification):
|
||||
return {
|
||||
"type": "integer",
|
||||
"minimum": 0
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class PlannedColdInstanceMigrateCount(IndicatorSpecification):
|
||||
@@ -186,7 +204,7 @@ class PlannedColdInstanceMigrateCount(IndicatorSpecification):
|
||||
return {
|
||||
"type": "integer",
|
||||
"minimum": 0
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class VolumeMigrateCount(IndicatorSpecification):
|
||||
@@ -202,7 +220,7 @@ class VolumeMigrateCount(IndicatorSpecification):
|
||||
return {
|
||||
"type": "integer",
|
||||
"minimum": 0
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class PlannedVolumeMigrateCount(IndicatorSpecification):
|
||||
@@ -219,7 +237,7 @@ class PlannedVolumeMigrateCount(IndicatorSpecification):
|
||||
return {
|
||||
"type": "integer",
|
||||
"minimum": 0
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class VolumeUpdateCount(IndicatorSpecification):
|
||||
@@ -236,7 +254,7 @@ class VolumeUpdateCount(IndicatorSpecification):
|
||||
return {
|
||||
"type": "integer",
|
||||
"minimum": 0
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class PlannedVolumeUpdateCount(IndicatorSpecification):
|
||||
@@ -253,4 +271,38 @@ class PlannedVolumeUpdateCount(IndicatorSpecification):
|
||||
return {
|
||||
"type": "integer",
|
||||
"minimum": 0
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class StandardDeviationValue(IndicatorSpecification):
|
||||
def __init__(self):
|
||||
super(StandardDeviationValue, self).__init__(
|
||||
name="standard_deviation_after_audit",
|
||||
description=_("The value of resulted standard deviation."),
|
||||
unit=None,
|
||||
required=False,
|
||||
)
|
||||
|
||||
@property
|
||||
def schema(self):
|
||||
return {
|
||||
"type": "number",
|
||||
"minimum": 0
|
||||
}
|
||||
|
||||
|
||||
class OriginalStandardDeviationValue(IndicatorSpecification):
|
||||
def __init__(self):
|
||||
super(OriginalStandardDeviationValue, self).__init__(
|
||||
name="standard_deviation_before_audit",
|
||||
description=_("The value of original standard deviation."),
|
||||
unit=None,
|
||||
required=False,
|
||||
)
|
||||
|
||||
@property
|
||||
def schema(self):
|
||||
return {
|
||||
"type": "number",
|
||||
"minimum": 0
|
||||
}
|
||||
|
||||
@@ -55,6 +55,32 @@ class ServerConsolidation(base.EfficacySpecification):
|
||||
return global_efficacy
|
||||
|
||||
|
||||
class WorkloadBalancing(base.EfficacySpecification):
|
||||
|
||||
def get_indicators_specifications(self):
|
||||
return [
|
||||
indicators.InstanceMigrationsCount(),
|
||||
indicators.InstancesCount(),
|
||||
indicators.StandardDeviationValue(),
|
||||
indicators.OriginalStandardDeviationValue()
|
||||
]
|
||||
|
||||
def get_global_efficacy_indicator(self, indicators_map=None):
|
||||
gl_indicators = []
|
||||
mig_value = 0
|
||||
if indicators_map and indicators_map.instance_migrations_count > 0:
|
||||
mig_value = (
|
||||
indicators_map.instance_migrations_count /
|
||||
float(indicators_map.instances_count) * 100)
|
||||
gl_indicators.append(efficacy.Indicator(
|
||||
name="live_migrations_count",
|
||||
description=_("Ratio of migrated virtual machines to audited "
|
||||
"virtual machines"),
|
||||
unit='%',
|
||||
value=mig_value))
|
||||
return gl_indicators
|
||||
|
||||
|
||||
class HardwareMaintenance(base.EfficacySpecification):
|
||||
|
||||
def get_indicators_specifications(self):
|
||||
|
||||
@@ -141,7 +141,7 @@ class WorkloadBalancing(base.Goal):
|
||||
@classmethod
|
||||
def get_efficacy_specification(cls):
|
||||
"""The efficacy spec for the current goal"""
|
||||
return specs.Unclassified()
|
||||
return specs.WorkloadBalancing()
|
||||
|
||||
|
||||
class AirflowOptimization(base.Goal):
|
||||
|
||||
Reference in New Issue
Block a user