Do not confuse terminal stack statuses
When stack update issued HeatStack waits for terminal status to arrive. However if operation hasn't started yet status of previous operation may be returned which can be CREATE_COMPLETE which leaded to exception to be raised or UPDATE_COMPLETE of previous update which caused stack.push() to exit early. Now update operation will wait until stack status change from the state it was before update was issued. This is tracked by comparing previous and current tuple(creation time, update time) Change-Id: I3829f6945b590b942506d4b512e902939053d107 Closes-Bug: #1482989
This commit is contained in:
parent
3689366f0e
commit
8d52384fd3
@ -43,6 +43,7 @@ class HeatStack(murano_object.MuranoObject):
|
||||
self._applied = True
|
||||
self._description = description
|
||||
self._clients = helpers.get_environment(_context).clients
|
||||
self._last_stack_timestamps = (None, None)
|
||||
|
||||
def current(self, _context):
|
||||
client = self._clients.get_heat_client(_context)
|
||||
@ -110,7 +111,7 @@ class HeatStack(murano_object.MuranoObject):
|
||||
self._wait_state(context, status_func)
|
||||
return status[0]
|
||||
|
||||
def _wait_state(self, context, status_func):
|
||||
def _wait_state(self, context, status_func, wait_progress=False):
|
||||
tries = 4
|
||||
delay = 1
|
||||
while tries > 0:
|
||||
@ -133,9 +134,16 @@ class HeatStack(murano_object.MuranoObject):
|
||||
eventlet.sleep(delay)
|
||||
break
|
||||
|
||||
if 'IN_PROGRESS' in status or status == '_':
|
||||
last_stack_timestamps = self._last_stack_timestamps
|
||||
self._last_stack_timestamps = (None, None) if not stack_info \
|
||||
else(stack_info.creation_time, stack_info.updated_time)
|
||||
|
||||
if 'IN_PROGRESS' in status or status == '_' or (
|
||||
wait_progress and last_stack_timestamps ==
|
||||
self._last_stack_timestamps):
|
||||
eventlet.sleep(2)
|
||||
continue
|
||||
|
||||
if not status_func(status):
|
||||
reason = ': {0}'.format(
|
||||
stack_info.stack_status_reason) if stack_info else ''
|
||||
@ -190,7 +198,7 @@ class HeatStack(murano_object.MuranoObject):
|
||||
disable_rollback=True)
|
||||
self._wait_state(
|
||||
_context,
|
||||
lambda status: status == 'UPDATE_COMPLETE')
|
||||
lambda status: status == 'UPDATE_COMPLETE', True)
|
||||
else:
|
||||
self.delete(_context)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user