'Test that we handle InstanceTerminationFailure
which is propagated up from the underlying driver.'

def test_instance_termination_exception_sets_error(self):

    instance = self._create_fake_instance_obj()
    def fake_delete_instance(self, context, instance, bdms):
        raise exception.InstanceTerminationFailure(reason='')
    self.stub_out('nova.compute.manager.ComputeManager._delete_instance', fake_delete_instance)
    self.assertRaises(exception.InstanceTerminationFailure, self.compute.terminate_instance, self.context, instance, [], [])
    instance = db.instance_get_by_uuid(self.context, instance['uuid'])
    self.assertEqual(instance['vm_state'], vm_states.ERROR)
