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