From 312a84ec70ffc3cbbc9b1cbb2f8c62e4d21e97c8 Mon Sep 17 00:00:00 2001 From: Angus Salkeld Date: Mon, 23 Jul 2012 20:12:05 +1000 Subject: [PATCH] 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 --- heat/engine/autoscaling.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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], -- 2.45.2