summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2021-11-30 12:06:05 +0000
committerGerrit Code Review <review@openstack.org>2021-11-30 12:06:05 +0000
commit704389f155de5f87564bc0379472478c05fe0acb (patch)
treed30427dc32072be49fa4b1d3cc13fd581d2d8b72
parente04d206e0a811a025641696be3cd5d30a8cc2928 (diff)
parent6002015fec472e0c90c91055f1963f323a1793e7 (diff)
downloadheat-704389f155de5f87564bc0379472478c05fe0acb.tar.gz
Merge "Fix timeout calc of nested resource groups" into stable/wallaby
-rw-r--r--heat/engine/resources/openstack/heat/resource_group.py18
-rw-r--r--heat_integrationtests/functional/test_resource_group.py10
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 48ef05ae9..1bdc0c312 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:
@@ -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)
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