From 736be1fe274eff21e88936e5fe1f019a437fd416 Mon Sep 17 00:00:00 2001 From: huangtianhua Date: Mon, 13 Feb 2017 18:01:08 +0800 Subject: [PATCH] Release stack lock after export stack Change-Id: I69e3c8f20530a538bd39f3bc13cd86c923ce8f8f Closes-Bug: #1664159 --- heat/engine/service.py | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/heat/engine/service.py b/heat/engine/service.py index 235436c6cb..2f391ac741 100644 --- a/heat/engine/service.py +++ b/heat/engine/service.py @@ -1498,20 +1498,25 @@ class EngineService(service.ServiceBase): if not cfg.CONF.enable_stack_abandon: raise exception.NotSupported(feature='Stack Abandon') + def _stack_abandon(stk, abandon): + if abandon: + LOG.info('abandoning stack %s', stk.name) + stk.delete(abandon=abandon) + else: + LOG.info('exporting stack %s', stk.name) + st = self._get_stack(cnxt, stack_identity) stack = parser.Stack.load(cnxt, stack=st) lock = stack_lock.StackLock(cnxt, stack.id, self.engine_id) with lock.thread_lock(): # Get stack details before deleting it. stack_info = stack.prepare_abandon() - if abandon: - LOG.info('abandoning stack %s', st.name) - self.thread_group_mgr.start_with_acquired_lock(stack, - lock, - stack.delete, - abandon=True) - else: - LOG.info('exporting stack %s', st.name) + self.thread_group_mgr.start_with_acquired_lock(stack, + lock, + _stack_abandon, + stack, + abandon) + return stack_info def list_resource_types(self,