'Restore an instance from shelved mode.'

@wsgi.response(202)
@exts.expected_errors((404, 409))
@wsgi.action('unshelve')
def _unshelve(self, req, id, body):

    context = req.environ['nova.context']
    context.can((shelve_policies.POLICY_ROOT % 'unshelve'))
    instance = common.get_instance(self.compute_api, context, id)
    try:
        self.compute_api.unshelve(context, instance)
    except exception.InstanceUnknownCell as e:
        raise exc.HTTPNotFound(explanation=e.format_message())
    except exception.InstanceIsLocked as e:
        raise exc.HTTPConflict(explanation=e.format_message())
    except exception.InstanceInvalidState as state_error:
        common.raise_http_conflict_for_instance_invalid_state(state_error, 'unshelve', id)
