'Permit admins to suspend the server.'

@wsgi.response(202)
@extensions.expected_errors((404, 409))
@wsgi.action('suspend')
def _suspend(self, req, id, body):

    context = req.environ['nova.context']
    server = common.get_instance(self.compute_api, context, id)
    try:
        context.can((ss_policies.POLICY_ROOT % 'suspend'), target={'user_id': server.user_id, 'project_id': server.project_id})
        self.compute_api.suspend(context, server)
    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, 'suspend', id)
