Update heat autoscaling test and test templates

Now Ceilometer does not support cpu_util metric. Thats why
it was needed to rewrite existing test_autoscaling to use another
metric (network.incoming.bytes).

Change-Id: I2cfda7624c9736e68d1d2fde4cdc37457cf5a593
Closes-bug:#1538166
This commit is contained in:
Timur Nurlygayanov 2016-02-03 20:22:46 +03:00
parent 7bcddf1802
commit 3bc76a63a9
3 changed files with 42 additions and 60 deletions

View File

@ -9,7 +9,7 @@ parameters:
type: string
SecurityGroup:
type: string
Subnet:
Net:
type: string
resources:
@ -26,9 +26,9 @@ resources:
security_groups:
- get_param: SecurityGroup
networks:
- network: {get_param: Subnet}
- network: {get_param: Net}
min_size: 1
max_size: 2
max_size: 3
scale_up_policy:
type: OS::Heat::ScalingPolicy
@ -36,7 +36,7 @@ resources:
adjustment_type: change_in_capacity
auto_scaling_group_id: {get_resource: my_asg}
cooldown: 60
scaling_adjustment: 1
scaling_adjustment: 2
scale_down_policy:
type: OS::Heat::ScalingPolicy
@ -49,28 +49,28 @@ resources:
cpu_alarm_high:
type: OS::Ceilometer::Alarm
properties:
description: Scale-up if the average CPU > 50% for 1 minute
meter_name: cpu_util
statistic: avg
description: Scale-up if count of instance <= 1 for 1 minute
meter_name: network.incoming.bytes
statistic: count
period: 60
evaluation_periods: 1
threshold: 50
threshold: 1
alarm_actions:
- {get_attr: [scale_up_policy, alarm_url]}
matching_metadata: {'metadata.user_metadata.stack': {get_param: "OS::stack_id"}}
comparison_operator: gt
comparison_operator: le
cpu_alarm_low:
type: OS::Ceilometer::Alarm
properties:
description: Scale-down if the average CPU < 15% for 1 minutes
meter_name: cpu_util
statistic: avg
description: Scale-down if maximum count of instance > 2 for 1 minutes
meter_name: network.incoming.bytes
statistic: count
period: 60
evaluation_periods: 1
threshold: 15
threshold: 2
alarm_actions:
- {get_attr: [scale_down_policy, alarm_url]}
matching_metadata: {'metadata.user_metadata.stack': {get_param: "OS::stack_id"}}
comparison_operator: lt
comparison_operator: gt

View File

@ -24,7 +24,7 @@ resources:
security_groups:
- get_param: SecurityGroup
min_size: 1
max_size: 2
max_size: 3
scale_up_policy:
type: OS::Heat::ScalingPolicy
@ -32,7 +32,7 @@ resources:
adjustment_type: change_in_capacity
auto_scaling_group_id: {get_resource: my_asg}
cooldown: 60
scaling_adjustment: 1
scaling_adjustment: 2
scale_down_policy:
type: OS::Heat::ScalingPolicy
@ -45,28 +45,28 @@ resources:
cpu_alarm_high:
type: OS::Ceilometer::Alarm
properties:
description: Scale-up if the average CPU > 50% for 1 minute
meter_name: cpu_util
statistic: avg
description: Scale-up if count of instance <= 1 for 1 minute
meter_name: network.incoming.bytes
statistic: count
period: 60
evaluation_periods: 1
threshold: 50
threshold: 1
alarm_actions:
- {get_attr: [scale_up_policy, alarm_url]}
matching_metadata: {'metadata.user_metadata.stack': {get_param: "OS::stack_id"}}
comparison_operator: gt
comparison_operator: le
cpu_alarm_low:
type: OS::Ceilometer::Alarm
properties:
description: Scale-down if the average CPU < 15% for 1 minutes
meter_name: cpu_util
statistic: avg
description: Scale-down if maximum count of instance > 2 for 1 minutes
meter_name: network.incoming.bytes
statistic: count
period: 60
evaluation_periods: 1
threshold: 15
threshold: 2
alarm_actions:
- {get_attr: [scale_down_policy, alarm_url]}
matching_metadata: {'metadata.user_metadata.stack': {get_param: "OS::stack_id"}}
comparison_operator: lt
comparison_operator: gt

View File

@ -582,14 +582,12 @@ class HeatSmokeTests(heatmanager.HeatBaseTest):
6. Wait for the stack status to change to 'CREATE_COMPLETE'.
7. Create a floating IP.
8. Assign the floating IP to the instance of the stack.
9. Wait for instance is ready for load.
10. Load the instance CPU to initiate the stack scaling up.
11. Wait for the 2nd instance to be launched.
12. Release the instance CPU to initiate the stack scaling down.
13. Wait for the 2nd instance to be terminated.
14. Delete the file with private key.
15. Delete the stack.
16. Wait for the stack to be deleted.
9. Wait when the instance is ready to connect.
10. Wait for the 2nd instance to be launched.
11. Wait for the 2nd instance to be terminated.
12. Delete the file with private key.
13. Delete the stack.
14. Wait for the stack to be deleted.
Duration: 2200 s.
Deployment tags: Ceilometer
@ -635,7 +633,7 @@ class HeatSmokeTests(heatmanager.HeatBaseTest):
}
if 'neutron' in self.config.network.network_provider:
parameters['Subnet'], _ = self.create_network_resources()
parameters['Net'], _ = self.create_network_resources()
template = self.load_template('heat_autoscaling_neutron.yaml')
else:
template = self.load_template('heat_autoscaling_nova.yaml')
@ -690,42 +688,26 @@ class HeatSmokeTests(heatmanager.HeatBaseTest):
vm_connection, 120, 15
)
# start of vm loading
self.verify(
60, self.load_vm_cpu,
10, 'Can not create a process to load VM CPU.',
'loading VM CPU',
vm_connection
)
# launching the second instance during autoscaling
self.verify(
480, self.wait_for_autoscaling,
11, 'Failed to launch the 2nd instance per autoscaling alarm.',
720, self.wait_for_autoscaling,
10, 'Failed to launch the 2nd instance per autoscaling alarm.',
'launching the new instance per autoscaling alarm',
len(instances) + 1, 480, 10, reduced_stack_name
)
# finish of vm loading
self.verify(
180, self.release_vm_cpu,
12, 'Can not kill the process on VM to turn CPU load off.',
'turning off VM CPU load',
vm_connection
len(instances) + 2, 720, 10, reduced_stack_name
)
# termination of the second instance during autoscaling
self.verify(
480, self.wait_for_autoscaling,
13, 'Failed to terminate the 2nd instance per autoscaling alarm.',
720, self.wait_for_autoscaling,
11, 'Failed to terminate the 2nd instance per autoscaling alarm.',
'terminating the 2nd instance per autoscaling alarm',
len(instances), 480, 10, reduced_stack_name
len(instances) + 1, 720, 11, reduced_stack_name
)
# deletion of file with keypair from vm
self.verify(
10, self.delete_key_file,
14, 'The file with private key can not be deleted.',
12, 'The file with private key can not be deleted.',
'deleting the file with private key',
path_to_key
)
@ -733,13 +715,13 @@ class HeatSmokeTests(heatmanager.HeatBaseTest):
# deletion of stack
self.verify(
20, self.heat_client.stacks.delete,
15, 'Can not delete stack.',
13, 'Can not delete stack.',
'deleting stack',
stack.id
)
self.verify(
100, self.wait_for_stack_deleted,
16, 'Can not delete stack.',
14, 'Can not delete stack.',
'deleting stack',
stack.id
)