'Restore a shelved instance.'

@check_instance_lock
@check_instance_state(vm_state=[vm_states.SHELVED, vm_states.SHELVED_OFFLOADED])
def unshelve(self, context, instance):

    instance.task_state = task_states.UNSHELVING
    instance.save(expected_task_state=[None])
    self._record_action_start(context, instance, instance_actions.UNSHELVE)
    try:
        request_spec = objects.RequestSpec.get_by_instance_uuid(context, instance.uuid)
    except exception.RequestSpecNotFound:
        request_spec = None
    self.compute_task_api.unshelve_instance(context, instance, request_spec)
