Revert task state when terminate_instance fails

Calls to terminate_instance leave the instance task state as-is when
they raise an exception - this was introduced in Ie5701e5c as a
work-around for a bug with quota accounting, but introduced bugs with
power-state syncing. Ib72de1a4 removed the need for the original
work-around, and this change reverts Ie5701e5c.

Ie5701e5c worked around a bug in quota accounting by using the instance's
task state as a signal to communicate between the nova.compute.manager
and nova.compute.api modules: if the manager's terminate_instance method
failed, it would leave the instance task state as DELETING. If the user
retried the delete, the api would check the task state: if the
instance's task state was already DELETING, it would not decrement the
user's quota a second time.

Unfortunately, leaving an instance with an active task had the
side-effect of preventing the VM power-state from synchronizing, wedging
the instance (bug 1177584 and bug 1212420).

Ib72de1a4 changed the quota accounting mechanism, moving the quota
handling code out of the api module. The api code for the work-around to
check the DELETING task state was removed. However, the code for the
work-around in the manager was never cleaned up.

This change cleans up the nova.compute.manager work-around code, making
terminate_instance revert the task state to None upon failure.
Power-state syncing should work again, and quota handling is unaffected
by the change.

Fixes: bug 1177584, bug 1212420
Change-Id: I42c68d16dca56703d6b192bb452883e4d5ca80df
Merge "Revert task state when terminate_instance fails"