Refactor ResourceGroup._get_batches() to be much, much simpler
Previous changes to the way the templates are generated allow us to simplify this method without changing any behaviour. Change-Id: Ibd1a7b1641164b1d83b7286ddefd2393207381c1 Partially-Implements: blueprint scaling-group-common
This commit is contained in:
parent
69e44dbb17
commit
01c334f017
|
@ -508,9 +508,7 @@ class ResourceGroup(stack_resource.StackResource):
|
||||||
raise ValueError(msg)
|
raise ValueError(msg)
|
||||||
return self.stack.timeout_secs() - total_pause_time
|
return self.stack.timeout_secs() - total_pause_time
|
||||||
|
|
||||||
def _get_batches(self, targ_cap, init_cap, batch_size, min_in_service):
|
def _get_batches(self, targ_cap, curr_cap, batch_size, min_in_service):
|
||||||
curr_cap = init_cap
|
|
||||||
|
|
||||||
updated = 0
|
updated = 0
|
||||||
|
|
||||||
while updated < targ_cap:
|
while updated < targ_cap:
|
||||||
|
@ -520,17 +518,10 @@ class ResourceGroup(stack_resource.StackResource):
|
||||||
batch_size,
|
batch_size,
|
||||||
min_in_service)
|
min_in_service)
|
||||||
|
|
||||||
if new_cap <= init_cap:
|
new_names = list(self._resource_names(new_cap))
|
||||||
# Don't ever update existing nodes that are beyond the size
|
|
||||||
# of our target capacity, but continue to count them toward
|
|
||||||
# the number in service
|
|
||||||
high_water = targ_cap
|
|
||||||
else:
|
|
||||||
high_water = new_cap
|
|
||||||
new_names = list(self._resource_names(high_water))
|
|
||||||
|
|
||||||
num_created = max(new_cap - curr_cap, 0)
|
num_created = max(new_cap - curr_cap, 0)
|
||||||
create_names = new_names[high_water - num_created:]
|
create_names = new_names[new_cap - num_created:]
|
||||||
|
|
||||||
num_updates = total_new - max(new_cap - curr_cap, 0)
|
num_updates = total_new - max(new_cap - curr_cap, 0)
|
||||||
upd_start = targ_cap - (updated + num_updates)
|
upd_start = targ_cap - (updated + num_updates)
|
||||||
|
|
Loading…
Reference in New Issue