'Returns a tuple of HostStates given a list of computes.
Also updates the HostStates internal mapping for the HostManager.'

def _get_host_states(self, context, compute_nodes, services):

    seen_nodes = set()
    for (cell_uuid, computes) in compute_nodes.items():
        for compute in computes:
            service = services.get(compute.host)
            if (not service):
                LOG.warning(_LW('No    compute    service    record    found    for    host    %(host)s'), {'host': compute.host})
                continue
            host = compute.host
            node = compute.hypervisor_hostname
            state_key = (host, node)
            host_state = self.host_state_map.get(state_key)
            if (not host_state):
                host_state = self.host_state_cls(host, node, cell_uuid, compute=compute)
                self.host_state_map[state_key] = host_state
            host_state.update(compute, dict(service), self._get_aggregates_info(host), self._get_instance_info(context, compute))
            seen_nodes.add(state_key)
    dead_nodes = (set(self.host_state_map.keys()) - seen_nodes)
    for state_key in dead_nodes:
        (host, node) = state_key
        LOG.info(_LI('Removing    dead    compute    node    %(host)s:%(node)s    from    scheduler'), {'host': host, 'node': node})
        del self.host_state_map[state_key]
    return (self.host_state_map[host] for host in seen_nodes)
