From a2292edf96db5a2aa5eb481bfeeeac43edded7eb Mon Sep 17 00:00:00 2001 From: Zane Bitter Date: Mon, 4 Mar 2013 11:31:27 +0100 Subject: [PATCH] Separate public/private autoscaling adjust() APIs Internal uses of adjust() have slightly different needs. Change-Id: Ibb85425f08b7b2d78be2d9ef5c8a9f464b7eead1 Signed-off-by: Zane Bitter --- heat/engine/resources/autoscaling.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/heat/engine/resources/autoscaling.py b/heat/engine/resources/autoscaling.py index eaaf9797..ed1db336 100644 --- a/heat/engine/resources/autoscaling.py +++ b/heat/engine/resources/autoscaling.py @@ -253,8 +253,7 @@ class AutoScalingGroup(InstanceGroup, CooldownMixin): else: num_to_create = int(self.properties['MinSize']) - self.adjust(num_to_create, adjustment_type='ExactCapacity', - raise_on_error=True) + self._adjust(num_to_create) def handle_update(self, json_snippet): try: @@ -298,13 +297,16 @@ class AutoScalingGroup(InstanceGroup, CooldownMixin): new_capacity = int(self.properties['DesiredCapacity']) if new_capacity is not None: - self.adjust(new_capacity, adjustment_type='ExactCapacity', - raise_on_error=True) + self._adjust(new_capacity) return self.UPDATE_COMPLETE - def adjust(self, adjustment, adjustment_type='ChangeInCapacity', - raise_on_error=False): + def adjust(self, adjustment, adjustment_type='ChangeInCapacity'): + self._adjust(adjustment, adjustment_type, False) + + def _adjust(self, adjustment, adjustment_type='ExactCapacity', + raise_on_error=True): + if self._cooldown_inprogress(): logger.info("%s NOT performing scaling adjustment, cooldown %s" % (self.name, self.properties['Cooldown'])) -- 2.45.2