Add parameter aggregation_method for basic_consolidation
This parameter is required to fix tempest multinode test. Change-Id: I4014fb7a76ce74e1426378183ecef0308bc56ce7
This commit is contained in:
@@ -109,6 +109,12 @@ class BasicConsolidation(base.ServerConsolidationBaseStrategy):
|
|||||||
def granularity(self):
|
def granularity(self):
|
||||||
return self.input_parameters.get('granularity', 300)
|
return self.input_parameters.get('granularity', 300)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def aggregation_method(self):
|
||||||
|
return self.input_parameters.get(
|
||||||
|
'aggregation_method',
|
||||||
|
{"instance": 'mean', "node": 'mean'})
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_display_name(cls):
|
def get_display_name(cls):
|
||||||
return _("Basic offline consolidation")
|
return _("Basic offline consolidation")
|
||||||
@@ -142,6 +148,26 @@ class BasicConsolidation(base.ServerConsolidationBaseStrategy):
|
|||||||
"type": "number",
|
"type": "number",
|
||||||
"default": 300
|
"default": 300
|
||||||
},
|
},
|
||||||
|
"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'}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -258,11 +284,13 @@ class BasicConsolidation(base.ServerConsolidationBaseStrategy):
|
|||||||
def get_node_cpu_usage(self, node):
|
def get_node_cpu_usage(self, node):
|
||||||
resource_id = "%s_%s" % (node.uuid, node.hostname)
|
resource_id = "%s_%s" % (node.uuid, node.hostname)
|
||||||
return self.datasource_backend.get_host_cpu_usage(
|
return self.datasource_backend.get_host_cpu_usage(
|
||||||
resource_id, self.period, 'mean', granularity=self.granularity)
|
resource_id, self.period, self.aggregation_method['node'],
|
||||||
|
granularity=300)
|
||||||
|
|
||||||
def get_instance_cpu_usage(self, instance):
|
def get_instance_cpu_usage(self, instance):
|
||||||
return self.datasource_backend.get_instance_cpu_usage(
|
return self.datasource_backend.get_instance_cpu_usage(
|
||||||
instance.uuid, self.period, 'mean', granularity=self.granularity)
|
instance.uuid, self.period, self.aggregation_method['instance'],
|
||||||
|
granularity=300)
|
||||||
|
|
||||||
def calculate_score_node(self, node):
|
def calculate_score_node(self, node):
|
||||||
"""Calculate the score that represent the utilization level
|
"""Calculate the score that represent the utilization level
|
||||||
|
|||||||
Reference in New Issue
Block a user