Start scaling down in an InstanceGroup rolling update ASAP

When the effective batch size is reduced due to a dwindling number of
resources we need to update, we may be able to reduce the size of the group
prior to the final batch without violating the minimum number of members we
are required to keep in service. This change ensures that any excess nodes
are removed as soon as possible.

Change-Id: Ic7b9544825a92b8720dcff15fe581038dff43582
Partially-Implements: blueprint scaling-group-common
This commit is contained in:
Zane Bitter 2015-08-28 12:11:38 -04:00 committed by Steve Baker
parent 661122c256
commit a08262a6b7
3 changed files with 3 additions and 5 deletions

View File

@ -41,10 +41,8 @@ def next_batch(targ_capacity, curr_capacity, num_up_to_date, batch_size,
if num_up_to_date >= efft_min_sz:
new_capacity = targ_capacity
elif num_up_to_date == 0:
else:
new_capacity = max(targ_capacity - efft_bat_sz,
efft_min_sz) + efft_bat_sz
else:
new_capacity = curr_capacity
return new_capacity, efft_bat_sz

View File

@ -91,7 +91,7 @@ class TestNextBatch(common.HeatTestCase):
('3_3_0_2_4', dict(targ=3, curr=3, updated=0, bat_size=2, min_srv=4,
batch=(5, 2))),
('3_5_2_2_4', dict(targ=3, curr=5, updated=2, bat_size=2, min_srv=4,
batch=(5, 1))),
batch=(4, 1))),
('3_5_3_2_4', dict(targ=3, curr=5, updated=3, bat_size=2, min_srv=4,
batch=(3, 0))),
('4_4_0_4_0', dict(targ=4, curr=4, updated=0, bat_size=4, min_srv=0,

View File

@ -406,7 +406,7 @@ class TestGetBatches(common.HeatTestCase):
('3_2_0', dict(curr_cap=3, bat_size=2, min_serv=0,
batches=[(3, 2), (3, 1)])),
('3_2_4', dict(curr_cap=3, bat_size=2, min_serv=4,
batches=[(5, 2), (5, 1), (3, 0)])),
batches=[(5, 2), (4, 1), (3, 0)])),
('4_4_0', dict(curr_cap=4, bat_size=4, min_serv=0,
batches=[(4, 4)])),
('4_5_0', dict(curr_cap=4, bat_size=5, min_serv=0,