summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZane Bitter <zbitter@redhat.com>2018-08-30 17:26:01 -0400
committerZane Bitter <zbitter@redhat.com>2018-09-07 20:38:25 -0400
commit19784749b36050f8778195d0ed8cdca588960059 (patch)
tree6e4fe66de23e5cf829aeea1508a110a98d6c5b2c
parent779c028e7e1dca779b0b4f431116c7e96f505fe3 (diff)
downloadheat-19784749b36050f8778195d0ed8cdca588960059.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. This is modified from master to inline the _should_lock_on_action() method, which does not exist on this branch. Change-Id: I4eb20ad82cc3e9434da34500fafa3880567d0959 Story: #1727142 Task: 24939 (cherry picked from commit 83ae156927f879af59d7db518f888280ef369428)
-rw-r--r--heat/engine/resources/stack_resource.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/heat/engine/resources/stack_resource.py b/heat/engine/resources/stack_resource.py
index 097074142..d473f7f3a 100644
--- a/heat/engine/resources/stack_resource.py
+++ b/heat/engine/resources/stack_resource.py
@@ -409,12 +409,19 @@ 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.stack.convergence and
+ not self.abandon_in_progress and
+ action in {self.ADOPT, self.CREATE, self.UPDATE,
+ self.ROLLBACK, self.DELETE}) 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)