'Restore a previously deleted (but not reclaimed) instance.'

@check_instance_lock
@check_instance_state(vm_state=[vm_states.SOFT_DELETED])
def restore(self, context, instance):

    flavor = instance.get_flavor()
    (project_id, user_id) = quotas_obj.ids_from_instance(context, instance)
    compute_utils.check_num_instances_quota(context, flavor, 1, 1, project_id=project_id, user_id=user_id)
    self._record_action_start(context, instance, instance_actions.RESTORE)
    if instance.host:
        instance.task_state = task_states.RESTORING
        instance.deleted_at = None
        instance.save(expected_task_state=[None])
        self.compute_rpcapi.restore_instance(context, instance)
    else:
        instance.vm_state = vm_states.ACTIVE
        instance.task_state = None
        instance.deleted_at = None
        instance.save(expected_task_state=[None])
