1. create a stack with a nova server
2. snapshot the stack
3. there is something wrong happened while snapshot complete checking
4. the stack went to SNAPSHOT_FAILED status
5. delete the stack, then a KeyError exception raised:
......
File "/opt/stack/heat/heat/engine/resource.py", line 832, in delete_snapshot
yield self.action_handler_task('delete_snapshot', args=[data])
File "/opt/stack/heat/heat/engine/scheduler.py", line 315, in wrapper
step = next(subtask)
File "/opt/stack/heat/heat/engine/resource.py", line 530, in action_handler_task
handler_data = handler(*args)
File "/opt/stack/heat/heat/engine/resources/openstack/nova/server.py", line 1428, in handle_delete_snapshot
image_id = snapshot['resource_data']['snapshot_image_id']
KeyError: 'snapshot_image_id'
......
I believe we should set the data 'snapshot_image_id' immediately after creating the snapshot image, otherwise the image will residue in some cases.
Fix proposed to branch: master /review. openstack. org/177666
Review: https:/