Handle re-created resources in StackUpdateManager

Since Iaacc585b9806c08fd5a57c80c10eeb31cb0a8f71 got merged in Heat, we
can get into a state where a failed resource is recreated during update
after clearing a hook. That means that when we poll for events, we need
to check for that additional action and not limit to updates.

Change-Id: I2191a3f3df426eaa91fdd5b00299193a32efe366
Closes-Bug: #1677548
(cherry picked from commit ba113ca188)
This commit is contained in:
Thomas Herve 2017-03-30 11:48:41 +02:00 committed by Julie Pichon
parent eb115ddd5c
commit 078105651b
2 changed files with 6 additions and 9 deletions

View File

@ -160,9 +160,11 @@ class StackUpdateManager(object):
state = 'on_breakpoint'
elif ev.resource_status_reason == hook_clear_reason:
state = 'in_progress'
elif ev.resource_status == 'UPDATE_IN_PROGRESS':
elif ev.resource_status in ('CREATE_IN_PROGRESS',
'UPDATE_IN_PROGRESS'):
state = 'in_progress'
elif ev.resource_status == 'UPDATE_COMPLETE':
elif ev.resource_status in ('CREATE_COMPLETE',
'UPDATE_COMPLETE'):
state = 'completed'
resources[state][res.physical_resource_id] = res

View File

@ -53,14 +53,9 @@ class StackUpdateManagerTest(base.TestCase):
mock.MagicMock(
event_time='2015-03-25T09:15:04Z',
resource_name='Controller-0',
resource_status='CREATE_IN_PROGRESS',
resource_status='UPDATE_IN_PROGRESS',
resource_status_reason='UPDATE paused until Hook '
'pre-update is cleared'),
mock.MagicMock(
event_time='2015-03-25T09:15:02Z',
resource_name='Controller-1',
resource_status='CREATE_COMPLETE',
resource_status_reason=''),
'pre-update is cleared')
]
else:
return [