def _remove_host(self, req, id, host):
        """Removes a host from the specified aggregate."""
        context = _get_context(req)
        authorize(context)
        try:
            aggregate = self.api.remove_host_from_aggregate(context, id, host)
        except (exception.AggregateNotFound, exception.AggregateHostNotFound,
                exception.ComputeHostNotFound):
            LOG.info(_('Cannot remove host %(host)s in aggregate %(id)s'),
                     {'host': host, 'id': id})
            raise exc.HTTPNotFound()
        except exception.InvalidAggregateAction:
            LOG.info(_('Cannot remove host %(host)s in aggregate %(id)s'),
                     {'host': host, 'id': id})
            raise exc.HTTPConflict()
        return self._marshall_aggregate(aggregate)