Add parameter aggregation_method for work_stab
This parameter is required to fix tempest multinode test. Change-Id: Id0c6a01b831a6b15694fdb811a1f53f8c6303120
This commit is contained in:
@@ -82,6 +82,7 @@ class WorkloadStabilization(base.WorkloadStabilizationBaseStrategy):
|
|||||||
self.instance_metrics = None
|
self.instance_metrics = None
|
||||||
self.retry_count = None
|
self.retry_count = None
|
||||||
self.periods = None
|
self.periods = None
|
||||||
|
self.aggregation_method = None
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_name(cls):
|
def get_name(cls):
|
||||||
@@ -195,6 +196,26 @@ class WorkloadStabilization(base.WorkloadStabilizationBaseStrategy):
|
|||||||
},
|
},
|
||||||
"default": {"instance": 720, "node": 600}
|
"default": {"instance": 720, "node": 600}
|
||||||
},
|
},
|
||||||
|
"aggregation_method": {
|
||||||
|
"description": "Function used to aggregate multiple "
|
||||||
|
"measures into an aggregate. For example, "
|
||||||
|
"the min aggregation method will aggregate "
|
||||||
|
"the values of different measures to the "
|
||||||
|
"minimum value of all the measures in the "
|
||||||
|
"time range.",
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"instance": {
|
||||||
|
"type": "string",
|
||||||
|
"default": 'mean'
|
||||||
|
},
|
||||||
|
"node": {
|
||||||
|
"type": "string",
|
||||||
|
"default": 'mean'
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"default": {"instance": 'mean', "node": 'mean'}
|
||||||
|
},
|
||||||
"granularity": {
|
"granularity": {
|
||||||
"description": "The time between two measures in an "
|
"description": "The time between two measures in an "
|
||||||
"aggregated timeseries of a metric.",
|
"aggregated timeseries of a metric.",
|
||||||
@@ -241,7 +262,8 @@ class WorkloadStabilization(base.WorkloadStabilizationBaseStrategy):
|
|||||||
for meter in self.metrics:
|
for meter in self.metrics:
|
||||||
avg_meter = self.datasource_backend.statistic_aggregation(
|
avg_meter = self.datasource_backend.statistic_aggregation(
|
||||||
instance.uuid, meter, self.periods['instance'],
|
instance.uuid, meter, self.periods['instance'],
|
||||||
self.granularity, aggregation='mean')
|
self.granularity,
|
||||||
|
aggregation=self.aggregation_method['instance'])
|
||||||
if avg_meter is None:
|
if avg_meter is None:
|
||||||
LOG.warning(
|
LOG.warning(
|
||||||
"No values returned by %(resource_id)s "
|
"No values returned by %(resource_id)s "
|
||||||
@@ -284,7 +306,8 @@ class WorkloadStabilization(base.WorkloadStabilizationBaseStrategy):
|
|||||||
resource_id = node_id
|
resource_id = node_id
|
||||||
avg_meter = self.datasource_backend.statistic_aggregation(
|
avg_meter = self.datasource_backend.statistic_aggregation(
|
||||||
resource_id, self.instance_metrics[metric],
|
resource_id, self.instance_metrics[metric],
|
||||||
self.periods['node'], self.granularity, aggregation='mean')
|
self.periods['node'], self.granularity,
|
||||||
|
aggregation=self.aggregation_method['node'])
|
||||||
if avg_meter is None:
|
if avg_meter is None:
|
||||||
LOG.warning('No values returned by node %s for %s',
|
LOG.warning('No values returned by node %s for %s',
|
||||||
node_id, meter_name)
|
node_id, meter_name)
|
||||||
@@ -475,6 +498,7 @@ class WorkloadStabilization(base.WorkloadStabilizationBaseStrategy):
|
|||||||
self.instance_metrics = self.input_parameters.instance_metrics
|
self.instance_metrics = self.input_parameters.instance_metrics
|
||||||
self.retry_count = self.input_parameters.retry_count
|
self.retry_count = self.input_parameters.retry_count
|
||||||
self.periods = self.input_parameters.periods
|
self.periods = self.input_parameters.periods
|
||||||
|
self.aggregation_method = self.input_parameters.aggregation_method
|
||||||
|
|
||||||
def do_execute(self):
|
def do_execute(self):
|
||||||
migration = self.check_threshold()
|
migration = self.check_threshold()
|
||||||
|
|||||||
@@ -98,7 +98,8 @@ class TestWorkloadStabilization(base.TestCase):
|
|||||||
"memory.resident": "hardware.memory.used"},
|
"memory.resident": "hardware.memory.used"},
|
||||||
'host_choice': 'retry',
|
'host_choice': 'retry',
|
||||||
'retry_count': 1,
|
'retry_count': 1,
|
||||||
'periods': {"instance": 720, "node": 600}})
|
'periods': {"instance": 720, "node": 600},
|
||||||
|
'aggregation_method': {"instance": "mean", "node": "mean"}})
|
||||||
self.strategy.metrics = ["cpu_util", "memory.resident"]
|
self.strategy.metrics = ["cpu_util", "memory.resident"]
|
||||||
self.strategy.thresholds = {"cpu_util": 0.2, "memory.resident": 0.2}
|
self.strategy.thresholds = {"cpu_util": 0.2, "memory.resident": 0.2}
|
||||||
self.strategy.weights = {"cpu_util_weight": 1.0,
|
self.strategy.weights = {"cpu_util_weight": 1.0,
|
||||||
@@ -109,6 +110,7 @@ class TestWorkloadStabilization(base.TestCase):
|
|||||||
self.strategy.host_choice = 'retry'
|
self.strategy.host_choice = 'retry'
|
||||||
self.strategy.retry_count = 1
|
self.strategy.retry_count = 1
|
||||||
self.strategy.periods = {"instance": 720, "node": 600}
|
self.strategy.periods = {"instance": 720, "node": 600}
|
||||||
|
self.strategy.aggregation_method = {"instance": "mean", "node": "mean"}
|
||||||
|
|
||||||
def test_get_instance_load(self):
|
def test_get_instance_load(self):
|
||||||
model = self.fake_cluster.generate_scenario_1()
|
model = self.fake_cluster.generate_scenario_1()
|
||||||
|
|||||||
Reference in New Issue
Block a user