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 <asalkeld@redhat.com>
This commit is contained in:
parent
deebc5c42a
commit
312a84ec70
@ -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],
|
||||
|
Loading…
x
Reference in New Issue
Block a user