diff options
author | Zane Bitter <zbitter@redhat.com> | 2015-08-28 12:11:38 -0400 |
---|---|---|
committer | Steve Baker <sbaker@redhat.com> | 2015-09-07 08:38:13 +1200 |
commit | a08262a6b78bc8f9bf46f3fc1b8fbd90a9209499 (patch) | |
tree | 75fc203bb9ded7673e02dcfbc268cb0fbbbbef83 /heat | |
parent | 661122c256fa2dc3df7594c9f9151ac2ace3a1b3 (diff) | |
download | heat-a08262a6b78bc8f9bf46f3fc1b8fbd90a9209499.tar.gz |
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
Diffstat (limited to 'heat')
-rw-r--r-- | heat/scaling/rolling_update.py | 4 | ||||
-rw-r--r-- | heat/tests/autoscaling/test_rolling_update.py | 2 | ||||
-rw-r--r-- | heat/tests/test_instance_group.py | 2 |
3 files changed, 3 insertions, 5 deletions
diff --git a/heat/scaling/rolling_update.py b/heat/scaling/rolling_update.py index d1305df27..7dec0fd21 100644 --- a/heat/scaling/rolling_update.py +++ b/heat/scaling/rolling_update.py @@ -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 diff --git a/heat/tests/autoscaling/test_rolling_update.py b/heat/tests/autoscaling/test_rolling_update.py index 6d22c5b86..f2caa1af5 100644 --- a/heat/tests/autoscaling/test_rolling_update.py +++ b/heat/tests/autoscaling/test_rolling_update.py @@ -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, diff --git a/heat/tests/test_instance_group.py b/heat/tests/test_instance_group.py index 7aee4ca36..5ed190024 100644 --- a/heat/tests/test_instance_group.py +++ b/heat/tests/test_instance_group.py @@ -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, |