Merge "Release stack lock after export stack"

This commit is contained in:
Jenkins 2017-08-07 08:26:26 +00:00 committed by Gerrit Code Review
commit 91bb3e8781

View File

@ -1526,20 +1526,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,