Add zone migration strategy
This patch adds hardware maintenance goal, efficacy and zone migration strategy. Change-Id: I5bfee421780233ffeea8c1539aba720ae554983d Implements: blueprint zone-migration-strategy
This commit is contained in:
@@ -23,7 +23,10 @@ Unclassified = goals.Unclassified
|
||||
WorkloadBalancing = goals.WorkloadBalancing
|
||||
NoisyNeighbor = goals.NoisyNeighborOptimization
|
||||
SavingEnergy = goals.SavingEnergy
|
||||
HardwareMaintenance = goals.HardwareMaintenance
|
||||
|
||||
|
||||
__all__ = ("Dummy", "ServerConsolidation", "ThermalOptimization",
|
||||
"Unclassified", "WorkloadBalancing",
|
||||
"NoisyNeighborOptimization", "SavingEnergy")
|
||||
"NoisyNeighborOptimization", "SavingEnergy",
|
||||
"HardwareMaintenance")
|
||||
|
||||
@@ -112,3 +112,118 @@ class InstanceMigrationsCount(IndicatorSpecification):
|
||||
def schema(self):
|
||||
return voluptuous.Schema(
|
||||
voluptuous.Range(min=0), required=True)
|
||||
|
||||
|
||||
class LiveInstanceMigrateCount(IndicatorSpecification):
|
||||
def __init__(self):
|
||||
super(LiveInstanceMigrateCount, self).__init__(
|
||||
name="live_migrate_instance_count",
|
||||
description=_("The number of instances actually live migrated."),
|
||||
unit=None,
|
||||
)
|
||||
|
||||
@property
|
||||
def schema(self):
|
||||
return voluptuous.Schema(
|
||||
voluptuous.Range(min=0), required=True)
|
||||
|
||||
|
||||
class PlannedLiveInstanceMigrateCount(IndicatorSpecification):
|
||||
def __init__(self):
|
||||
super(PlannedLiveInstanceMigrateCount, self).__init__(
|
||||
name="planned_live_migrate_instance_count",
|
||||
description=_("The number of instances planned to live migrate."),
|
||||
unit=None,
|
||||
)
|
||||
|
||||
@property
|
||||
def schema(self):
|
||||
return voluptuous.Schema(
|
||||
voluptuous.Range(min=0), required=True)
|
||||
|
||||
|
||||
class ColdInstanceMigrateCount(IndicatorSpecification):
|
||||
def __init__(self):
|
||||
super(ColdInstanceMigrateCount, self).__init__(
|
||||
name="cold_migrate_instance_count",
|
||||
description=_("The number of instances actually cold migrated."),
|
||||
unit=None,
|
||||
)
|
||||
|
||||
@property
|
||||
def schema(self):
|
||||
return voluptuous.Schema(
|
||||
voluptuous.Range(min=0), required=True)
|
||||
|
||||
|
||||
class PlannedColdInstanceMigrateCount(IndicatorSpecification):
|
||||
def __init__(self):
|
||||
super(PlannedColdInstanceMigrateCount, self).__init__(
|
||||
name="planned_cold_migrate_instance_count",
|
||||
description=_("The number of instances planned to cold migrate."),
|
||||
unit=None,
|
||||
)
|
||||
|
||||
@property
|
||||
def schema(self):
|
||||
return voluptuous.Schema(
|
||||
voluptuous.Range(min=0), required=True)
|
||||
|
||||
|
||||
class VolumeMigrateCount(IndicatorSpecification):
|
||||
def __init__(self):
|
||||
super(VolumeMigrateCount, self).__init__(
|
||||
name="volume_migrate_count",
|
||||
description=_("The number of detached volumes actually migrated."),
|
||||
unit=None,
|
||||
)
|
||||
|
||||
@property
|
||||
def schema(self):
|
||||
return voluptuous.Schema(
|
||||
voluptuous.Range(min=0), required=True)
|
||||
|
||||
|
||||
class PlannedVolumeMigrateCount(IndicatorSpecification):
|
||||
def __init__(self):
|
||||
super(PlannedVolumeMigrateCount, self).__init__(
|
||||
name="planned_volume_migrate_count",
|
||||
description=_("The number of detached volumes planned"
|
||||
" to migrate."),
|
||||
unit=None,
|
||||
)
|
||||
|
||||
@property
|
||||
def schema(self):
|
||||
return voluptuous.Schema(
|
||||
voluptuous.Range(min=0), required=True)
|
||||
|
||||
|
||||
class VolumeUpdateCount(IndicatorSpecification):
|
||||
def __init__(self):
|
||||
super(VolumeUpdateCount, self).__init__(
|
||||
name="volume_update_count",
|
||||
description=_("The number of attached volumes actually"
|
||||
" migrated."),
|
||||
unit=None,
|
||||
)
|
||||
|
||||
@property
|
||||
def schema(self):
|
||||
return voluptuous.Schema(
|
||||
voluptuous.Range(min=0), required=True)
|
||||
|
||||
|
||||
class PlannedVolumeUpdateCount(IndicatorSpecification):
|
||||
def __init__(self):
|
||||
super(PlannedVolumeUpdateCount, self).__init__(
|
||||
name="planned_volume_update_count",
|
||||
description=_("The number of attached volumes planned to"
|
||||
" migrate."),
|
||||
unit=None,
|
||||
)
|
||||
|
||||
@property
|
||||
def schema(self):
|
||||
return voluptuous.Schema(
|
||||
voluptuous.Range(min=0), required=True)
|
||||
|
||||
@@ -53,3 +53,86 @@ class ServerConsolidation(base.EfficacySpecification):
|
||||
))
|
||||
|
||||
return global_efficacy
|
||||
|
||||
|
||||
class HardwareMaintenance(base.EfficacySpecification):
|
||||
|
||||
def get_indicators_specifications(self):
|
||||
return [
|
||||
indicators.LiveInstanceMigrateCount(),
|
||||
indicators.PlannedLiveInstanceMigrateCount(),
|
||||
indicators.ColdInstanceMigrateCount(),
|
||||
indicators.PlannedColdInstanceMigrateCount(),
|
||||
indicators.VolumeMigrateCount(),
|
||||
indicators.PlannedVolumeMigrateCount(),
|
||||
indicators.VolumeUpdateCount(),
|
||||
indicators.PlannedVolumeUpdateCount()
|
||||
]
|
||||
|
||||
def get_global_efficacy_indicator(self, indicators_map=None):
|
||||
li_value = 0
|
||||
if (indicators_map and
|
||||
indicators_map.planned_live_migrate_instance_count > 0):
|
||||
li_value = (
|
||||
float(indicators_map.planned_live_migrate_instance_count)
|
||||
/ float(indicators_map.live_migrate_instance_count)
|
||||
* 100
|
||||
)
|
||||
|
||||
li_indicator = efficacy.Indicator(
|
||||
name="live_instance_migrate_ratio",
|
||||
description=_("Ratio of actual live migrated instances "
|
||||
"to planned live migrate instances."),
|
||||
unit='%',
|
||||
value=li_value)
|
||||
|
||||
ci_value = 0
|
||||
if (indicators_map and
|
||||
indicators_map.planned_cold_migrate_instance_count > 0):
|
||||
ci_value = (
|
||||
float(indicators_map.planned_cold_migrate_instance_count)
|
||||
/ float(indicators_map.cold_migrate_instance_count)
|
||||
* 100
|
||||
)
|
||||
|
||||
ci_indicator = efficacy.Indicator(
|
||||
name="cold_instance_migrate_ratio",
|
||||
description=_("Ratio of actual cold migrated instances "
|
||||
"to planned cold migrate instances."),
|
||||
unit='%',
|
||||
value=ci_value)
|
||||
|
||||
dv_value = 0
|
||||
if (indicators_map and
|
||||
indicators_map.planned_volume_migrate_count > 0):
|
||||
dv_value = (float(indicators_map.planned_volume_migrate_count) /
|
||||
float(indicators_map.
|
||||
volume_migrate_count)
|
||||
* 100)
|
||||
|
||||
dv_indicator = efficacy.Indicator(
|
||||
name="volume_migrate_ratio",
|
||||
description=_("Ratio of actual detached volumes migrated to"
|
||||
" planned detached volumes migrate."),
|
||||
unit='%',
|
||||
value=dv_value)
|
||||
|
||||
av_value = 0
|
||||
if (indicators_map and
|
||||
indicators_map.planned_volume_update_count > 0):
|
||||
av_value = (float(indicators_map.planned_volume_update_count) /
|
||||
float(indicators_map.
|
||||
volume_update_count)
|
||||
* 100)
|
||||
|
||||
av_indicator = efficacy.Indicator(
|
||||
name="volume_update_ratio",
|
||||
description=_("Ratio of actual attached volumes migrated to"
|
||||
" planned attached volumes migrate."),
|
||||
unit='%',
|
||||
value=av_value)
|
||||
|
||||
return [li_indicator,
|
||||
ci_indicator,
|
||||
dv_indicator,
|
||||
av_indicator]
|
||||
|
||||
@@ -216,3 +216,28 @@ class SavingEnergy(base.Goal):
|
||||
def get_efficacy_specification(cls):
|
||||
"""The efficacy spec for the current goal"""
|
||||
return specs.Unclassified()
|
||||
|
||||
|
||||
class HardwareMaintenance(base.Goal):
|
||||
"""HardwareMaintenance
|
||||
|
||||
This goal is to migrate instances and volumes on a set of compute nodes
|
||||
and storage from nodes under maintenance
|
||||
"""
|
||||
|
||||
@classmethod
|
||||
def get_name(cls):
|
||||
return "hardware_maintenance"
|
||||
|
||||
@classmethod
|
||||
def get_display_name(cls):
|
||||
return _("Hardware Maintenance")
|
||||
|
||||
@classmethod
|
||||
def get_translatable_display_name(cls):
|
||||
return "Hardware Maintenance"
|
||||
|
||||
@classmethod
|
||||
def get_efficacy_specification(cls):
|
||||
"""The efficacy spec for the current goal"""
|
||||
return specs.HardwareMaintenance()
|
||||
|
||||
Reference in New Issue
Block a user