'Get a list of hosts with DVR servicable ports on subnet_ids.'

def _get_dvr_hosts_for_subnets(self, context, subnet_ids):

    Binding = ml2_models.PortBinding
    Port = models_v2.Port
    IPAllocation = models_v2.IPAllocation
    query = context.session.query(Binding.host).distinct()
    query = query.join(Binding.port)
    query = query.join(Port.fixed_ips)
    query = query.filter(IPAllocation.subnet_id.in_(subnet_ids))
    owner_filter = or_(Port.device_owner.startswith(n_const.DEVICE_OWNER_COMPUTE_PREFIX), Port.device_owner.in_(n_utils.get_other_dvr_serviced_device_owners()))
    query = query.filter(owner_filter)
    hosts = [item[0] for item in query]
    return hosts
