diff options
author | Zane Bitter <zbitter@redhat.com> | 2015-08-28 23:28:03 -0400 |
---|---|---|
committer | Steve Baker <sbaker@redhat.com> | 2015-09-08 08:44:18 +1200 |
commit | 7fb7d765be66fac3284a9816a40397a7207158a6 (patch) | |
tree | f5089012b7f04ec4c4c33389b346d964f238b9af /heat/scaling | |
parent | 9a6f2525743d77fb6e468b57d56c241e8e366d08 (diff) | |
download | heat-7fb7d765be66fac3284a9816a40397a7207158a6.tar.gz |
Handle scaling up in scaling library next_batch() function
Handle the case where targ_capacity > curr_capacity.
Change-Id: I53d6f51a3ff0f7e813720e28f9decfc8ef118a89
Partially-Implements: blueprint scaling-group-common
Diffstat (limited to 'heat/scaling')
-rw-r--r-- | heat/scaling/rolling_update.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/heat/scaling/rolling_update.py b/heat/scaling/rolling_update.py index 7dec0fd21..c662aa4c6 100644 --- a/heat/scaling/rolling_update.py +++ b/heat/scaling/rolling_update.py @@ -36,13 +36,13 @@ def next_batch(targ_capacity, curr_capacity, num_up_to_date, batch_size, update. """ - efft_min_sz = min(min_in_service, targ_capacity) + assert num_up_to_date <= curr_capacity + + efft_min_sz = min(min_in_service, targ_capacity, curr_capacity) efft_bat_sz = min(batch_size, max(targ_capacity - num_up_to_date, 0)) - if num_up_to_date >= efft_min_sz: - new_capacity = targ_capacity - else: - new_capacity = max(targ_capacity - efft_bat_sz, - efft_min_sz) + efft_bat_sz + new_capacity = efft_bat_sz + max(min(curr_capacity, + targ_capacity - efft_bat_sz), + efft_min_sz) return new_capacity, efft_bat_sz |