If libvirt fails to power off a VM during the shutdown called from within do_terminate_instance() it raises exception.InstancePowerOffFailure. However do_terminate_instance doesn’t catch this, and so two (IMO bad) things happen:
i) The instance doesn’t go to an Error (Deleting) state
ii) @reverts_task_state sets task_state to None – putting the instance into Active(None)
This makes the user think the system has just ignored their request, so the repeate the delete, and repeate the delete ….
Proposed changes:
- Catch exception.InstancePowerOffFailure so that the instance goes to Error(Deleting)
- Remove the reverts_task_state decorator from terminate_instance. Delete is a non-reversible operation for the user, and many systems stop billing for instances once the user has indicated that they want to delete the instance (from that point on is the system’s problem to complete the delete as soon as possible. No failure during delete should set the instance back to Active(None)
Sorry Aditi - I already have a fix proposed for this: https:/ /review. openstack. org/#/c/ 58829/
somehow it didn't get linked back to the bug