Wait for state progress of Heat stack upon delete

When Murano deletes Heat stack it waits for stack to
disappear handling intermediate DELETE_IN_PROGRESS
status. However if Heat doesn't immediately starts stack
deletion the first status observed might be UPDATE_COMPLETE
or CREATE_COMPLETE. This unexpected stack will cause exception
to be thrown and internal variable holding stack content no to
be reset. As a result subsequent stack.push() calls can recreate the
stack.

The solution is to wait for stack progress before waiting for
terminal state. This ability was added earlier and used for stack updates
but not for delete(). However delete() brings another corner case that
need to be handled - attempt to delete stack that is not exist. In this
case there is not going to be any status progress so Murano must not
wait for it (because otherwise it will wait forever). This case needs special
handling.

Change-Id: I6f4782879b85ac5691d3c3a7203e8fa60fdbbeaf
Closes-Bug: #1526876
This commit is contained in:
Stan Lagun 2015-12-22 03:15:19 +03:00
parent 6b9145f6e9
commit cc3739d021
1 changed files with 4 additions and 2 deletions

View File

@ -151,7 +151,8 @@ class HeatStack(object):
else(stack_info.creation_time, stack_info.updated_time)
if (wait_progress and last_stack_timestamps ==
self._last_stack_timestamps):
self._last_stack_timestamps and
last_stack_timestamps != (None, None)):
eventlet.sleep(2)
continue
@ -223,7 +224,8 @@ class HeatStack(object):
return
client.stacks.delete(stack_id=self._name)
self._wait_state(
lambda status: status in ('DELETE_COMPLETE', 'NOT_FOUND'))
lambda status: status in ('DELETE_COMPLETE', 'NOT_FOUND'),
wait_progress=True)
except heat_exc.NotFound:
LOG.warning(_LW('Stack {stack_name} already deleted?')
.format(stack_name=self._name))