From: Angus Salkeld Date: Mon, 23 Jul 2012 10:12:05 +0000 (+1000) Subject: autoscaling: don't kill all instances when scaling down X-Git-Tag: 2014.1~1571 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=312a84ec70ffc3cbbc9b1cbb2f8c62e4d21e97c8;p=openstack-build%2Fheat-build.git autoscaling: don't kill all instances when scaling down only delete the difference between the old capacity and the new capacity doh! Change-Id: Idbb16b2fa93abcad2793d5b4365c18a01e588b99 Signed-off-by: Angus Salkeld --- diff --git a/heat/engine/autoscaling.py b/heat/engine/autoscaling.py index 7389d9b5..86a51857 100644 --- a/heat/engine/autoscaling.py +++ b/heat/engine/autoscaling.py @@ -101,7 +101,10 @@ class AutoScalingGroup(Resource): return if new_capacity == capacity: + logger.debug('no change in capacity %d' % capacity) return + logger.debug('adjusting capacity from %d to %d' % (capacity, + new_capacity)) conf = self.properties['LaunchConfigurationName'] if new_capacity > capacity: @@ -116,7 +119,7 @@ class AutoScalingGroup(Resource): inst.create() else: # shrink (kill largest numbered first) - del_list = inst_list[:] + del_list = inst_list[new_capacity:] for victim in reversed(del_list): inst = instance.Instance(victim, self.stack.t['Resources'][conf],