Merge "Don't scale when action is not complete"

This commit is contained in:
Jenkins 2016-04-20 18:20:53 +00:00 committed by Gerrit Code Review
commit 3f26de868b
2 changed files with 19 additions and 0 deletions

View File

@ -281,6 +281,11 @@ class AutoScalingGroup(instgrp.InstanceGroup, cooldown.CooldownMixin):
adjustment_type=sc_util.CFN_CHANGE_IN_CAPACITY,
min_adjustment_step=None):
"""Adjust the size of the scaling group if the cooldown permits."""
if self.status != self.COMPLETE:
LOG.info(_LI("%s NOT performing scaling adjustment, "
"when status is not COMPLETE") % self.name)
raise exception.NoActionRequired()
capacity = grouputils.get_size(self)
new_capacity = self._get_new_capacity(capacity, adjustment,
adjustment_type,

View File

@ -322,6 +322,20 @@ class TestGroupAdjust(common.HeatTestCase):
self.assertEqual(0, resize.call_count)
self.assertEqual(0, finished_scaling.call_count)
def test_scaling_update_in_progress(self):
"""Don't resize when update in progress"""
self.group.state_set('UPDATE', 'IN_PROGRESS')
resize = self.patchobject(self.group, 'resize')
finished_scaling = self.patchobject(self.group, '_finished_scaling')
notify = self.patch('heat.engine.notification.autoscaling.send')
self.assertRaises(exception.NoActionRequired,
self.group.adjust, 3,
adjustment_type='ExactCapacity')
expected_notifies = []
self.assertEqual(expected_notifies, notify.call_args_list)
self.assertEqual(0, resize.call_count)
self.assertEqual(0, finished_scaling.call_count)
def test_scale_up_min_adjustment(self):
self.patchobject(grouputils, 'get_size', return_value=1)
resize = self.patchobject(self.group, 'resize')