'Restore a soft-deleted instance on this host.'

@wrap_exception()
@reverts_task_state
@wrap_instance_event(prefix='compute')
@wrap_instance_fault
def restore_instance(self, context, instance):

    self._notify_about_instance_usage(context, instance, 'restore.start')
    compute_utils.notify_about_instance_action(context, instance, self.host, action=fields.NotificationAction.RESTORE, phase=fields.NotificationPhase.START)
    try:
        self.driver.restore(instance)
    except NotImplementedError:
        self._power_on(context, instance)
    instance.power_state = self._get_power_state(context, instance)
    instance.vm_state = vm_states.ACTIVE
    instance.task_state = None
    instance.save(expected_task_state=task_states.RESTORING)
    self._notify_about_instance_usage(context, instance, 'restore.end')
    compute_utils.notify_about_instance_action(context, instance, self.host, action=fields.NotificationAction.RESTORE, phase=fields.NotificationPhase.END)
