aclgroup__users__login=owner)
        assert len(accessible_hosts) <= len(atomic_hosts)
        if len(accessible_hosts) != len(atomic_hosts):
            accessible_hostnames = set(h['hostname'] for h in accessible_hosts)
            acl_excluded_hostnames = (set(atomic_hostnames) -
                                      accessible_hostnames)
            for hostname in acl_excluded_hostnames:
                acls = ','.join(hostname_to_acl_name_list[hostname])
                host_exclude_reasons.setdefault(hostname, []).append(
                    'User %s does not have ACL access. ACLs: %s' % (
                        owner, acls))

        # Check for locked hosts.
        locked_hosts = [h for h in atomic_hosts if h['locked']]
        for host in locked_hosts:
            locker = host.get('locked_by') or 'UNKNOWN'
            msg = 'Locked by user %s on %s.  No jobs will schedule on it.' % (
                locker, host.get('lock_time'))
            host_exclude_reasons.setdefault(host['hostname'], []).append(msg)

        # Exclude hosts that are not Ready.
        for host in atomic_hosts:
            hostname = host['hostname']
            if host['status'] != 'Ready':
                message = 'Status is %s' % host['status']
                if host['status'] in ('Verifying', 'Pending', 'Running'):
                    running_hqes = proxy.run(
                        'get_host_queue_entries', host__hostname=hostname,
                        status__in=RUNNING_HQE_STATUSES)
                    if not running_hqes:
                        message += ' (unknown job)'
                                     aclgroup__users__login=owner)
        assert len(accessible_hosts) <= len(atomic_hosts)
        if len(accessible_hosts) != len(atomic_hosts):
            accessible_hostnames = set(h['hostname'] for h in accessible_hosts)
            acl_excluded_hostnames = (set(atomic_hostnames) -
                                      accessible_hostnames)
            for hostname in acl_excluded_hostnames:
                acls = ','.join(hostname_to_acl_name_list[hostname])
                host_exclude_reasons.setdefault(hostname, []).append(
                    'User %s does not have ACL access. ACLs: %s' %
                    (owner, acls))

        # Check for locked hosts.
        locked_hosts = [h for h in atomic_hosts if h['locked']]
        for host in locked_hosts:
            locker = host.get('locked_by') or 'UNKNOWN'
            msg = 'Locked by user %s on %s.  No jobs will schedule on it.' % (
                locker, host.get('lock_time'))
            host_exclude_reasons.setdefault(host['hostname'], []).append(msg)

        # Exclude hosts that are not Ready.
        for host in atomic_hosts:
            hostname = host['hostname']
            if host['status'] != 'Ready':
                message = 'Status is %s' % host['status']
                if host['status'] in ('Verifying', 'Pending', 'Running'):
                    running_hqes = proxy.run('get_host_queue_entries',
                                             host__hostname=hostname,
                                             status__in=RUNNING_HQE_STATUSES)
                    if not running_hqes:
                        message += ' (unknown job)'
        # Exclude any hosts that ACLs deny us access to.
        accessible_hosts = proxy.run("get_hosts", hostname__in=atomic_hostnames, aclgroup__users__login=owner)
        assert len(accessible_hosts) <= len(atomic_hosts)
        if len(accessible_hosts) != len(atomic_hosts):
            accessible_hostnames = set(h["hostname"] for h in accessible_hosts)
            acl_excluded_hostnames = set(atomic_hostnames) - accessible_hostnames
            for hostname in acl_excluded_hostnames:
                acls = ",".join(hostname_to_acl_name_list[hostname])
                host_exclude_reasons.setdefault(hostname, []).append(
                    "User %s does not have ACL access. ACLs: %s" % (owner, acls)
                )

        # Check for locked hosts.
        locked_hosts = [h for h in atomic_hosts if h["locked"]]
        for host in locked_hosts:
            locker = host.get("locked_by") or "UNKNOWN"
            msg = "Locked by user %s on %s.  No jobs will schedule on it." % (locker, host.get("lock_time"))
            host_exclude_reasons.setdefault(host["hostname"], []).append(msg)

        # Exclude hosts that are not Ready.
        for host in atomic_hosts:
            hostname = host["hostname"]
            if host["status"] != "Ready":
                message = "Status is %s" % host["status"]
                if host["status"] in ("Verifying", "Pending", "Running"):
                    running_hqes = proxy.run(
                        "get_host_queue_entries", host__hostname=hostname, status__in=RUNNING_HQE_STATUSES
                    )
                    if not running_hqes:
                        message += " (unknown job)"
                    else: