diff options
author | Zuul <zuul@review.opendev.org> | 2022-07-06 12:36:35 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2022-07-06 12:36:35 +0000 |
commit | f7100908290c0bb8633a9977ee4f9969e7076e29 (patch) | |
tree | 7afee4ae84298d236158cd001707e4631cc504ef | |
parent | 54e28129e6c50baa1dd0b341c056d30795101925 (diff) | |
parent | b69657a3493c461c917d8747fd00f1a5531e74ad (diff) | |
download | heat-f7100908290c0bb8633a9977ee4f9969e7076e29.tar.gz |
Merge "Fix timeout calc of nested resource groups" into stable/victoria
-rw-r--r-- | heat/engine/resources/openstack/heat/resource_group.py | 18 | ||||
-rw-r--r-- | heat_integrationtests/functional/test_resource_group.py | 10 |
2 files changed, 13 insertions, 15 deletions
diff --git a/heat/engine/resources/openstack/heat/resource_group.py b/heat/engine/resources/openstack/heat/resource_group.py index d6fb46e5d..f9275c92d 100644 --- a/heat/engine/resources/openstack/heat/resource_group.py +++ b/heat/engine/resources/openstack/heat/resource_group.py @@ -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: @@ -770,13 +771,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) diff --git a/heat_integrationtests/functional/test_resource_group.py b/heat_integrationtests/functional/test_resource_group.py index 999d41122..07be7f24c 100644 --- a/heat_integrationtests/functional/test_resource_group.py +++ b/heat_integrationtests/functional/test_resource_group.py @@ -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 |