Add period input parameter to basic strategy
This patch set adds new period strategy input parameter which allows allows to specify the time length of statistic aggregation. Partial-Bug: #1614021 Change-Id: I1a276206e5b2c05d8f94acdeb866c8822fa84f35
This commit is contained in:
committed by
Alexander Chadin
parent
4a5d8cf709
commit
e03f56e7c7
@@ -101,6 +101,10 @@ class BasicConsolidation(base.ServerConsolidationBaseStrategy):
|
||||
def migration_attempts(self):
|
||||
return self.input_parameters.get('migration_attempts', 0)
|
||||
|
||||
@property
|
||||
def period(self):
|
||||
return self.input_parameters.get('period', 7200)
|
||||
|
||||
@classmethod
|
||||
def get_display_name(cls):
|
||||
return _("Basic offline consolidation")
|
||||
@@ -122,6 +126,12 @@ class BasicConsolidation(base.ServerConsolidationBaseStrategy):
|
||||
"type": "number",
|
||||
"default": 0
|
||||
},
|
||||
"period": {
|
||||
"description": "The time interval in seconds for "
|
||||
"getting statistic aggregation",
|
||||
"type": "number",
|
||||
"default": 7200
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -247,14 +257,14 @@ class BasicConsolidation(base.ServerConsolidationBaseStrategy):
|
||||
return self.ceilometer.statistic_aggregation(
|
||||
resource_id=resource_id,
|
||||
meter_name=metric_name,
|
||||
period="7200",
|
||||
period=self.period,
|
||||
aggregate='avg',
|
||||
)
|
||||
elif self.config.datasource == "monasca":
|
||||
statistics = self.monasca.statistic_aggregation(
|
||||
meter_name=metric_name,
|
||||
dimensions=dict(hostname=node.uuid),
|
||||
period=7200,
|
||||
period=self.period,
|
||||
aggregate='avg'
|
||||
)
|
||||
cpu_usage = None
|
||||
@@ -276,14 +286,14 @@ class BasicConsolidation(base.ServerConsolidationBaseStrategy):
|
||||
return self.ceilometer.statistic_aggregation(
|
||||
resource_id=instance.uuid,
|
||||
meter_name=metric_name,
|
||||
period="7200",
|
||||
period=self.period,
|
||||
aggregate='avg'
|
||||
)
|
||||
elif self.config.datasource == "monasca":
|
||||
statistics = self.monasca.statistic_aggregation(
|
||||
meter_name=metric_name,
|
||||
dimensions=dict(resource_id=instance.uuid),
|
||||
period=7200,
|
||||
period=self.period,
|
||||
aggregate='avg'
|
||||
)
|
||||
cpu_usage = None
|
||||
|
||||
Reference in New Issue
Block a user