From 8341cc3ec3756fc955fb3942fd5855e084f32a39 Mon Sep 17 00:00:00 2001 From: Zane Bitter Date: Thu, 30 Aug 2018 17:26:01 -0400 Subject: [PATCH] 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) --- heat/engine/resources/stack_resource.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/heat/engine/resources/stack_resource.py b/heat/engine/resources/stack_resource.py index a29ab8ecaf..d5d7bd64ee 100644 --- a/heat/engine/resources/stack_resource.py +++ b/heat/engine/resources/stack_resource.py @@ -443,12 +443,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)