Merge "Fix timeout calc of nested resource groups"
This commit is contained in:
commit
ef187fc65b
@ -15,6 +15,7 @@ import collections
|
||||
import copy
|
||||
import functools
|
||||
import itertools
|
||||
import math
|
||||
|
||||
from oslo_log import log as logging
|
||||
|
||||
@ -433,18 +434,18 @@ class ResourceGroup(stack_resource.StackResource):
|
||||
return False
|
||||
return True
|
||||
|
||||
def _run_to_completion(self, template, timeout):
|
||||
def _run_to_completion(self, template, timeout_mins):
|
||||
updater = self.update_with_template(template, {},
|
||||
timeout)
|
||||
timeout_mins)
|
||||
|
||||
while not super(ResourceGroup,
|
||||
self).check_update_complete(updater):
|
||||
yield
|
||||
|
||||
def _run_update(self, total_capacity, max_updates, timeout):
|
||||
def _run_update(self, total_capacity, max_updates, timeout_mins):
|
||||
template = self._assemble_for_rolling_update(total_capacity,
|
||||
max_updates)
|
||||
return self._run_to_completion(template, timeout)
|
||||
return self._run_to_completion(template, timeout_mins)
|
||||
|
||||
def check_update_complete(self, checkers):
|
||||
for checker in checkers:
|
||||
@ -776,13 +777,18 @@ class ResourceGroup(stack_resource.StackResource):
|
||||
|
||||
batches = list(self._get_batches(self.get_size(), curr_cap, batch_size,
|
||||
min_in_service))
|
||||
update_timeout = self._update_timeout(len(batches), pause_sec)
|
||||
update_timeout_secs = self._update_timeout(len(batches), pause_sec)
|
||||
|
||||
# NOTE(gibi) update_timeout is in seconds but the _run_update
|
||||
# eventually calls StackResource.update_with_template that takes
|
||||
# timeout in minutes so we need to convert here.
|
||||
update_timeout_mins = math.ceil(update_timeout_secs / 60)
|
||||
|
||||
def tasks():
|
||||
for index, (curr_cap, max_upd) in enumerate(batches):
|
||||
yield scheduler.TaskRunner(self._run_update,
|
||||
curr_cap, max_upd,
|
||||
update_timeout)
|
||||
update_timeout_mins)
|
||||
|
||||
if index < (len(batches) - 1) and pause_sec > 0:
|
||||
yield scheduler.TaskRunner(pause_between_batch, pause_sec)
|
||||
|
@ -181,15 +181,7 @@ resources:
|
||||
nested_stack = self.client.stacks.get(res.physical_resource_id)
|
||||
timeouts.add(nested_stack.timeout_mins)
|
||||
|
||||
# FIXME(gibi): This is bug story/2009237 as the timeout calculation of
|
||||
# nested resource groups are broken. It is using seconds for the
|
||||
# calculation but then pass that to functions expecting timeouts in
|
||||
# minutes leading to increasing timeout value with each nesting level.
|
||||
self.assertEqual({35939, 599}, timeouts)
|
||||
# After the bug is fixed we expect timeouts less than the overall
|
||||
# timeout requested for the whole stack.
|
||||
|
||||
# self.assertEqual({10}, timeouts)
|
||||
self.assertEqual({10}, timeouts)
|
||||
|
||||
def test_update_increase_decrease_count(self):
|
||||
# create stack with resource group count 2
|
||||
|
Loading…
x
Reference in New Issue
Block a user