'Adds a host to the specified aggregate.'

@extensions.expected_errors((404, 409))
@wsgi.action('add_host')
@validation.schema(aggregates.add_host)
def _add_host(self, req, id, body):

    host = body['add_host']['host']
    context = _get_context(req)
    context.can((aggr_policies.POLICY_ROOT % 'add_host'))
    try:
        aggregate = self.api.add_host_to_aggregate(context, id, host)
    except (exception.AggregateNotFound, exception.HostMappingNotFound, exception.ComputeHostNotFound) as e:
        raise exc.HTTPNotFound(explanation=e.format_message())
    except (exception.AggregateHostExists, exception.InvalidAggregateAction) as e:
        raise exc.HTTPConflict(explanation=e.format_message())
    return self._marshall_aggregate(req, aggregate)
