def _read_compute_topology():
    LOG.debug("Reading compute nodes topology from {config}".format(
              config=CONF.compute_topology_file))
    ctx = context.ctx()
    tenant_id = str(ctx.tenant_id)
    topology = {}
    try:
        with open(CONF.compute_topology_file) as f:
            for line in f:
                line = line.strip()
                if not line:
                    continue
                (host, path) = line.split()
                # Calulating host id based on tenant id and host
                # using the same algorithm as in nova
                # see nova/api/openstack/compute/views/servers.py
                # def _get_host_id(instance):
                sha_hash = hashlib.sha224(tenant_id + host)
                topology[sha_hash.hexdigest()] = path
    except __HOLE__:
        raise ex.NotFoundException(
            CONF.compute_topology_file,
            _("Unable to find file %s with compute topology"))
    return topology
dataset/ETHPy150Open openstack/sahara/sahara/topology/topology_helper.py/_read_compute_topology