diff options
author | Zane Bitter <zbitter@redhat.com> | 2018-08-30 17:26:01 -0400 |
---|---|---|
committer | Zane Bitter <zbitter@redhat.com> | 2018-09-07 20:32:12 -0400 |
commit | 9aea139cf78a5503d7d5804a21a1927d97d63d8a (patch) | |
tree | 82d61752abcc871a11161320215bcd72be4866c0 | |
parent | 02adac50a91a5e457938945aaa087c0d66564002 (diff) | |
download | heat-9aea139cf78a5503d7d5804a21a1927d97d63d8a.tar.gz |
Ignore spurious nested stack locks in convergence
Several operations (e.g. stack check) are yet to be converted to
convergence-style workflows, and still create locks. While we try to always
remove dead locks, it's possible that if one of these gets left behind we
won't notice, since convergence doesn't actually use stack locks for most
regular operations.
When doing _check_status_complete() on a nested stack resource, we wait for
the operation to release the nested stack's lock before reporting the
resource completed, to ensure that for legacy operations the nested stack
is ready to perform another action on as soon as the resource is complete.
For convergence stacks this is an unnecessary DB call, and it can lead to
resources never completing if a stray lock happens to be left in the
database.
Only check the nested stack's stack lock for operations where we are not
taking a resource lock. This corresponds exactly to legacy-style
operations.
Change-Id: I4eb20ad82cc3e9434da34500fafa3880567d0959
Story: #1727142
Task: 24939
(cherry picked from commit 83ae156927f879af59d7db518f888280ef369428)
-rw-r--r-- | heat/engine/resources/stack_resource.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/heat/engine/resources/stack_resource.py b/heat/engine/resources/stack_resource.py index c678878a9..7def946c5 100644 --- a/heat/engine/resources/stack_resource.py +++ b/heat/engine/resources/stack_resource.py @@ -448,12 +448,16 @@ class StackResource(resource.Resource): if status == self.IN_PROGRESS: return False elif status == self.COMPLETE: - ret = stack_lock.StackLock.get_engine_id( - self.context, self.resource_id) is None - if ret: + # For operations where we do not take a resource lock + # (i.e. legacy-style), check that the stack lock has been + # released before reporting completeness. + done = (self._should_lock_on_action(expected_action) or + stack_lock.StackLock.get_engine_id( + self.context, self.resource_id) is None) + if done: # Reset nested, to indicate we changed status self._nested = None - return ret + return done elif status == self.FAILED: raise exception.ResourceFailure(status_reason, self, action=action) |