Merge "Add 'cooldown' attribute to scaling policy"
This commit is contained in:
commit
db5a60659b
|
@ -79,11 +79,13 @@ class AutoscalingTest(TestCase):
|
||||||
max_instances: 10
|
max_instances: 10
|
||||||
default_instances: 3
|
default_instances: 3
|
||||||
increment: 1
|
increment: 1
|
||||||
|
cooldown: 60
|
||||||
'''
|
'''
|
||||||
|
|
||||||
expectedprops = {'desired_capacity': 3,
|
expectedprops = {'desired_capacity': 3,
|
||||||
'max_size': 10,
|
'max_size': 10,
|
||||||
'min_size': 2,
|
'min_size': 2,
|
||||||
|
'cooldown': 60,
|
||||||
'resource': {'type': 'asg_res.yaml'}}
|
'resource': {'type': 'asg_res.yaml'}}
|
||||||
|
|
||||||
self._tosca_scaling_test(
|
self._tosca_scaling_test(
|
||||||
|
|
|
@ -94,6 +94,8 @@ class ToscaAutoscaling(HotResource):
|
||||||
self.properties["adjustment_type"] = "change_in_capacity "
|
self.properties["adjustment_type"] = "change_in_capacity "
|
||||||
self.properties["scaling_adjustment"] = self.\
|
self.properties["scaling_adjustment"] = self.\
|
||||||
policy.entity_tpl["properties"]["increment"]
|
policy.entity_tpl["properties"]["increment"]
|
||||||
|
self.properties["cooldown"] =\
|
||||||
|
self.policy.entity_tpl["properties"]["cooldown"]
|
||||||
delete_res_names = []
|
delete_res_names = []
|
||||||
scale_res = []
|
scale_res = []
|
||||||
for index, resource in enumerate(resources):
|
for index, resource in enumerate(resources):
|
||||||
|
@ -105,6 +107,7 @@ class ToscaAutoscaling(HotResource):
|
||||||
res["min_size"] = temp["min_instances"]
|
res["min_size"] = temp["min_instances"]
|
||||||
res["max_size"] = temp["max_instances"]
|
res["max_size"] = temp["max_instances"]
|
||||||
res["desired_capacity"] = temp["default_instances"]
|
res["desired_capacity"] = temp["default_instances"]
|
||||||
|
res["cooldown"] = temp["cooldown"]
|
||||||
props['type'] = resource.type
|
props['type'] = resource.type
|
||||||
props['properties'] = resource.properties
|
props['properties'] = resource.properties
|
||||||
res['resource'] = {'type': self.policy.name + '_res.yaml'}
|
res['resource'] = {'type': self.policy.name + '_res.yaml'}
|
||||||
|
|
|
@ -38,3 +38,4 @@ topology_template:
|
||||||
max_instances: 10
|
max_instances: 10
|
||||||
default_instances: 3
|
default_instances: 3
|
||||||
increment: 1
|
increment: 1
|
||||||
|
cooldown: 60
|
||||||
|
|
|
@ -10,6 +10,7 @@ resources:
|
||||||
properties:
|
properties:
|
||||||
min_size: 2
|
min_size: 2
|
||||||
desired_capacity: 3
|
desired_capacity: 3
|
||||||
|
cooldown: 60
|
||||||
resource:
|
resource:
|
||||||
type: asg_res.yaml
|
type: asg_res.yaml
|
||||||
max_size: 10
|
max_size: 10
|
||||||
|
@ -20,6 +21,7 @@ resources:
|
||||||
get_resource: asg_group
|
get_resource: asg_group
|
||||||
adjustment_type: change_in_capacity
|
adjustment_type: change_in_capacity
|
||||||
scaling_adjustment: 1
|
scaling_adjustment: 1
|
||||||
|
cooldown: 60
|
||||||
asg_scale_in:
|
asg_scale_in:
|
||||||
type: OS::Heat::ScalingPolicy
|
type: OS::Heat::ScalingPolicy
|
||||||
properties:
|
properties:
|
||||||
|
@ -27,6 +29,7 @@ resources:
|
||||||
get_resource: asg_group
|
get_resource: asg_group
|
||||||
adjustment_type: change_in_capacity
|
adjustment_type: change_in_capacity
|
||||||
scaling_adjustment: -1
|
scaling_adjustment: -1
|
||||||
|
cooldown: 60
|
||||||
asg_alarm:
|
asg_alarm:
|
||||||
type: OS::Aodh::Alarm
|
type: OS::Aodh::Alarm
|
||||||
properties:
|
properties:
|
||||||
|
|
|
@ -12,6 +12,7 @@ resources:
|
||||||
get_resource: asg_group
|
get_resource: asg_group
|
||||||
adjustment_type: change_in_capacity
|
adjustment_type: change_in_capacity
|
||||||
scaling_adjustment: 1
|
scaling_adjustment: 1
|
||||||
|
cooldown: 60
|
||||||
low_cpu_usage:
|
low_cpu_usage:
|
||||||
type: OS::Aodh::Alarm
|
type: OS::Aodh::Alarm
|
||||||
properties:
|
properties:
|
||||||
|
@ -30,6 +31,7 @@ resources:
|
||||||
resource:
|
resource:
|
||||||
type: asg_res.yaml
|
type: asg_res.yaml
|
||||||
max_size: 10
|
max_size: 10
|
||||||
|
cooldown: 60
|
||||||
asg_scale_in:
|
asg_scale_in:
|
||||||
type: OS::Heat::ScalingPolicy
|
type: OS::Heat::ScalingPolicy
|
||||||
properties:
|
properties:
|
||||||
|
@ -37,6 +39,7 @@ resources:
|
||||||
get_resource: asg_group
|
get_resource: asg_group
|
||||||
adjustment_type: change_in_capacity
|
adjustment_type: change_in_capacity
|
||||||
scaling_adjustment: -1
|
scaling_adjustment: -1
|
||||||
|
cooldown: 60
|
||||||
high_cpu_usage:
|
high_cpu_usage:
|
||||||
type: OS::Aodh::Alarm
|
type: OS::Aodh::Alarm
|
||||||
properties:
|
properties:
|
||||||
|
|
|
@ -12,6 +12,7 @@ resources:
|
||||||
get_resource: SP1_group
|
get_resource: SP1_group
|
||||||
adjustment_type: change_in_capacity
|
adjustment_type: change_in_capacity
|
||||||
scaling_adjustment: 1
|
scaling_adjustment: 1
|
||||||
|
cooldown: 120
|
||||||
SP1_group:
|
SP1_group:
|
||||||
type: OS::Heat::AutoScalingGroup
|
type: OS::Heat::AutoScalingGroup
|
||||||
properties:
|
properties:
|
||||||
|
@ -20,6 +21,7 @@ resources:
|
||||||
resource:
|
resource:
|
||||||
type: SP1_res.yaml
|
type: SP1_res.yaml
|
||||||
max_size: 3
|
max_size: 3
|
||||||
|
cooldown: 120
|
||||||
SP1_scale_in:
|
SP1_scale_in:
|
||||||
type: OS::Heat::ScalingPolicy
|
type: OS::Heat::ScalingPolicy
|
||||||
properties:
|
properties:
|
||||||
|
@ -27,4 +29,5 @@ resources:
|
||||||
get_resource: SP1_group
|
get_resource: SP1_group
|
||||||
adjustment_type: change_in_capacity
|
adjustment_type: change_in_capacity
|
||||||
scaling_adjustment: -1
|
scaling_adjustment: -1
|
||||||
|
cooldown: 120
|
||||||
outputs: {}
|
outputs: {}
|
|
@ -30,6 +30,7 @@ topology_template:
|
||||||
max_instances: 10
|
max_instances: 10
|
||||||
default_instances: 3
|
default_instances: 3
|
||||||
increment: 1
|
increment: 1
|
||||||
|
cooldown: 60
|
||||||
|
|
||||||
- cpu_monitoring:
|
- cpu_monitoring:
|
||||||
type: tosca.policies.Monitoring
|
type: tosca.policies.Monitoring
|
||||||
|
|
Loading…
Reference in New Issue