Merge "Don't scale when action is not complete"
This commit is contained in:
commit
3f26de868b
@ -281,6 +281,11 @@ class AutoScalingGroup(instgrp.InstanceGroup, cooldown.CooldownMixin):
|
|||||||
adjustment_type=sc_util.CFN_CHANGE_IN_CAPACITY,
|
adjustment_type=sc_util.CFN_CHANGE_IN_CAPACITY,
|
||||||
min_adjustment_step=None):
|
min_adjustment_step=None):
|
||||||
"""Adjust the size of the scaling group if the cooldown permits."""
|
"""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)
|
capacity = grouputils.get_size(self)
|
||||||
new_capacity = self._get_new_capacity(capacity, adjustment,
|
new_capacity = self._get_new_capacity(capacity, adjustment,
|
||||||
adjustment_type,
|
adjustment_type,
|
||||||
|
@ -322,6 +322,20 @@ class TestGroupAdjust(common.HeatTestCase):
|
|||||||
self.assertEqual(0, resize.call_count)
|
self.assertEqual(0, resize.call_count)
|
||||||
self.assertEqual(0, finished_scaling.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):
|
def test_scale_up_min_adjustment(self):
|
||||||
self.patchobject(grouputils, 'get_size', return_value=1)
|
self.patchobject(grouputils, 'get_size', return_value=1)
|
||||||
resize = self.patchobject(self.group, 'resize')
|
resize = self.patchobject(self.group, 'resize')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user