Add 'cooldown' attribute to scaling policy

Currently, Tacker cannot leverage fully Heat Translator because
the lack of attribute.

Change-Id: I14fb9d9b6a0addf4529e6d21a2af7b3c7947926f
This commit is contained in:
doantungbk 2017-05-17 01:17:09 -07:00
parent 8184fa5a65
commit 3ce7de1d64
7 changed files with 16 additions and 0 deletions

View File

@ -79,11 +79,13 @@ class AutoscalingTest(TestCase):
max_instances: 10
default_instances: 3
increment: 1
cooldown: 60
'''
expectedprops = {'desired_capacity': 3,
'max_size': 10,
'min_size': 2,
'cooldown': 60,
'resource': {'type': 'asg_res.yaml'}}
self._tosca_scaling_test(

View File

@ -94,6 +94,8 @@ class ToscaAutoscaling(HotResource):
self.properties["adjustment_type"] = "change_in_capacity "
self.properties["scaling_adjustment"] = self.\
policy.entity_tpl["properties"]["increment"]
self.properties["cooldown"] =\
self.policy.entity_tpl["properties"]["cooldown"]
delete_res_names = []
scale_res = []
for index, resource in enumerate(resources):
@ -105,6 +107,7 @@ class ToscaAutoscaling(HotResource):
res["min_size"] = temp["min_instances"]
res["max_size"] = temp["max_instances"]
res["desired_capacity"] = temp["default_instances"]
res["cooldown"] = temp["cooldown"]
props['type'] = resource.type
props['properties'] = resource.properties
res['resource'] = {'type': self.policy.name + '_res.yaml'}

View File

@ -38,3 +38,4 @@ topology_template:
max_instances: 10
default_instances: 3
increment: 1
cooldown: 60

View File

@ -10,6 +10,7 @@ resources:
properties:
min_size: 2
desired_capacity: 3
cooldown: 60
resource:
type: asg_res.yaml
max_size: 10
@ -20,6 +21,7 @@ resources:
get_resource: asg_group
adjustment_type: change_in_capacity
scaling_adjustment: 1
cooldown: 60
asg_scale_in:
type: OS::Heat::ScalingPolicy
properties:
@ -27,6 +29,7 @@ resources:
get_resource: asg_group
adjustment_type: change_in_capacity
scaling_adjustment: -1
cooldown: 60
asg_alarm:
type: OS::Aodh::Alarm
properties:

View File

@ -12,6 +12,7 @@ resources:
get_resource: asg_group
adjustment_type: change_in_capacity
scaling_adjustment: 1
cooldown: 60
low_cpu_usage:
type: OS::Aodh::Alarm
properties:
@ -30,6 +31,7 @@ resources:
resource:
type: asg_res.yaml
max_size: 10
cooldown: 60
asg_scale_in:
type: OS::Heat::ScalingPolicy
properties:
@ -37,6 +39,7 @@ resources:
get_resource: asg_group
adjustment_type: change_in_capacity
scaling_adjustment: -1
cooldown: 60
high_cpu_usage:
type: OS::Aodh::Alarm
properties:

View File

@ -12,6 +12,7 @@ resources:
get_resource: SP1_group
adjustment_type: change_in_capacity
scaling_adjustment: 1
cooldown: 120
SP1_group:
type: OS::Heat::AutoScalingGroup
properties:
@ -20,6 +21,7 @@ resources:
resource:
type: SP1_res.yaml
max_size: 3
cooldown: 120
SP1_scale_in:
type: OS::Heat::ScalingPolicy
properties:
@ -27,4 +29,5 @@ resources:
get_resource: SP1_group
adjustment_type: change_in_capacity
scaling_adjustment: -1
cooldown: 120
outputs: {}

View File

@ -30,6 +30,7 @@ topology_template:
max_instances: 10
default_instances: 3
increment: 1
cooldown: 60
- cpu_monitoring:
type: tosca.policies.Monitoring