Retrigger new traversals after resource timeout

If a resource times out, we still need to check whether there is a new
traversal underway that we need to retrigger, otherwise the new traversal
will never complete.

Change-Id: I4ac7ac88797b7fb14046b5668649b2277ee55517
Closes-Bug: #1721654
This commit is contained in:
Zane Bitter 2017-10-18 16:46:39 -04:00
parent 6a9672a264
commit bb330ae1a6
3 changed files with 15 additions and 8 deletions

View File

@ -151,11 +151,8 @@ class CheckResource(object):
self._handle_resource_failure(cnxt, is_update, rsrc.id,
stack, reason)
except scheduler.Timeout:
# reload the stack to verify current traversal
stack = parser.Stack.load(cnxt, stack_id=stack.id)
if stack.current_traversal != current_traversal:
return
self._handle_stack_timeout(cnxt, stack)
self._handle_resource_failure(cnxt, is_update, rsrc.id,
stack, u'Timed out')
except CancelOperation:
pass

View File

@ -476,15 +476,15 @@ class CheckWorkflowUpdateTest(common.HeatTestCase):
mock_hf.assert_called_once_with(self.ctx, self.stack, u'Timed out')
@mock.patch.object(check_resource.CheckResource,
'_handle_stack_timeout')
'_handle_failure')
def test_do_check_resource_marks_stack_as_failed_if_stack_timesout(
self, mock_hst, mock_cru, mock_crc, mock_pcr, mock_csc):
self, mock_hf, mock_cru, mock_crc, mock_pcr, mock_csc):
mock_cru.side_effect = scheduler.Timeout(None, 60)
self.is_update = True
self.cr._do_check_resource(self.ctx, self.stack.current_traversal,
self.stack.t, {}, self.is_update,
self.resource, self.stack, {})
mock_hst.assert_called_once_with(self.ctx, self.stack)
mock_hf.assert_called_once_with(self.ctx, self.stack, u'Timed out')
@mock.patch.object(check_resource.CheckResource,
'_handle_stack_timeout')

View File

@ -81,3 +81,13 @@ class SimultaneousUpdateStackTest(functional_base.FunctionalTestsBase):
time.sleep(10)
self.update_stack(stack_id, after)
@test.requires_convergence
def test_retrigger_timeout(self):
before, after = get_templates(delay_s=70)
stack_id = self.stack_create(template=before,
expected_status='CREATE_IN_PROGRESS',
timeout=1)
time.sleep(50)
self.update_stack(stack_id, after)