Merge "Add resource_type in trigger policy"
This commit is contained in:
commit
12be9db589
|
@ -87,9 +87,10 @@ topology_template:
|
|||
implementation: ceilometer
|
||||
condition:
|
||||
constraint: 50
|
||||
period: 600
|
||||
granularity: 600
|
||||
evaluations: 1
|
||||
method: avg
|
||||
aggregation_method: mean
|
||||
resource_type: instance
|
||||
action:
|
||||
resize_compute:
|
||||
action_name: SP1
|
||||
|
|
|
@ -67,9 +67,10 @@ topology_template:
|
|||
capability: Container
|
||||
condition:
|
||||
constraint: { greater_than: 50 }
|
||||
period: 60
|
||||
granularity: 60
|
||||
evaluations: 1
|
||||
method: average
|
||||
aggregation_method: mean
|
||||
resource_type: instance
|
||||
action:
|
||||
resize: # Operation name
|
||||
inputs:
|
||||
|
@ -77,26 +78,28 @@ topology_template:
|
|||
implementation: Senlin.webhook()
|
||||
high_cpu_usage:
|
||||
description: trigger
|
||||
meter_name: cpu_util
|
||||
metric: cpu_util
|
||||
condition:
|
||||
constraint: utilization greater_than 60%
|
||||
threshold: 60
|
||||
period: 600
|
||||
granularity: 600
|
||||
evaluations: 1
|
||||
method: average
|
||||
aggregation_method: mean
|
||||
resource_type: instance
|
||||
comparison_operator: gt
|
||||
metadata: SG1
|
||||
action: [SP1]
|
||||
|
||||
low_cpu_usage:
|
||||
description: trigger
|
||||
meter_name: cpu_util
|
||||
metric: cpu_util
|
||||
condition:
|
||||
constraint: utilization less_than 20%
|
||||
threshold: 20
|
||||
period: 600
|
||||
granularity: 600
|
||||
evaluations: 1
|
||||
method: average
|
||||
aggregation_method: mean
|
||||
resource_type: instance
|
||||
comparison_operator: gt
|
||||
metadata: SG1
|
||||
action: [SP1]
|
||||
|
|
|
@ -1626,9 +1626,9 @@ heat-translator/master/translator/tests/data/custom_types/wordpress.yaml
|
|||
capability: Container
|
||||
condition:
|
||||
constraint: { greater_than: 50 }
|
||||
period: 60
|
||||
granularity: 60
|
||||
evaluations: 1
|
||||
method : average
|
||||
aggregation_method : mean
|
||||
action:
|
||||
resize: # Operation name
|
||||
inputs:
|
||||
|
@ -1645,13 +1645,14 @@ heat-translator/master/translator/tests/data/custom_types/wordpress.yaml
|
|||
triggers:
|
||||
- high_cpu_usage:
|
||||
description: trigger
|
||||
meter_name: cpu_util
|
||||
metric: cpu_util
|
||||
condition:
|
||||
constraint: utilization greater_than 60%
|
||||
threshold: 60
|
||||
period: 600
|
||||
granularity: 600
|
||||
evaluations: 1
|
||||
method: average
|
||||
aggregation_method: mean
|
||||
resource_type: instance
|
||||
comparison_operator: gt
|
||||
metadata: SG1
|
||||
action: [SP1]
|
||||
|
@ -1676,9 +1677,10 @@ heat-translator/master/translator/tests/data/custom_types/wordpress.yaml
|
|||
capability: Container
|
||||
condition:
|
||||
constraint: utilization greater_than 50%
|
||||
period1: 60
|
||||
granularity1: 60
|
||||
evaluations: 1
|
||||
method: average
|
||||
aggregation_method: mean
|
||||
resource_type: instance
|
||||
action:
|
||||
resize: # Operation name
|
||||
inputs:
|
||||
|
@ -1702,13 +1704,14 @@ heat-translator/master/translator/tests/data/custom_types/wordpress.yaml
|
|||
triggers:
|
||||
- high_cpu_usage:
|
||||
description: trigger
|
||||
meter_name: cpu_util
|
||||
metric: cpu_util
|
||||
condition:
|
||||
constraint: utilization greater_than 60%
|
||||
threshold: 60
|
||||
period: 600
|
||||
granularity: 600
|
||||
evaluations: 1
|
||||
method: average
|
||||
aggregation_method: mean
|
||||
resource_type: instance
|
||||
comparison_operator: gt
|
||||
metadata1: SG1
|
||||
action: [SP1]
|
||||
|
|
|
@ -18,14 +18,15 @@ from toscaparser.common.exception import UnknownFieldError
|
|||
from toscaparser.entity_template import EntityTemplate
|
||||
from toscaparser.utils import validateutils
|
||||
|
||||
SECTIONS = (DESCRIPTION, EVENT, SCHEDULE, METER_NAME, METADATA,
|
||||
SECTIONS = (DESCRIPTION, EVENT, SCHEDULE, METRIC, METADATA,
|
||||
TARGET_FILTER, CONDITION, ACTION) = \
|
||||
('description', 'event_type', 'schedule', 'meter_name',
|
||||
('description', 'event_type', 'schedule', 'metric',
|
||||
'metadata', 'target_filter', 'condition', 'action')
|
||||
CONDITION_KEYNAMES = (CONSTRAINT, PERIOD, EVALUATIONS, METHOD,
|
||||
THRESHOLD, COMPARISON_OPERATOR) = \
|
||||
('constraint', 'period', 'evaluations',
|
||||
'method', 'threshold', 'comparison_operator')
|
||||
CONDITION_KEYNAMES = (CONSTRAINT, GRANULARITY, EVALUATIONS, AGGREGATION_METHOD,
|
||||
THRESHOLD, COMPARISON_OPERATOR, RESOURCE_TYPE) = \
|
||||
('constraint', 'granularity', 'evaluations',
|
||||
'aggregation_method', 'threshold', 'comparison_operator',
|
||||
'resource_type')
|
||||
log = logging.getLogger('tosca')
|
||||
|
||||
|
||||
|
@ -74,9 +75,9 @@ class Triggers(EntityTemplate):
|
|||
|
||||
def _validate_input(self):
|
||||
for key, value in self.get_condition().items():
|
||||
if key in [PERIOD, EVALUATIONS]:
|
||||
if key in [GRANULARITY, EVALUATIONS]:
|
||||
validateutils.validate_integer(value)
|
||||
elif key == THRESHOLD:
|
||||
validateutils.validate_numeric(value)
|
||||
elif key in [METER_NAME, METHOD]:
|
||||
elif key in [METRIC, AGGREGATION_METHOD]:
|
||||
validateutils.validate_string(value)
|
||||
|
|
Loading…
Reference in New Issue