def get_hosts_list_from_affinity(bench, sorted_list=False):
    affinity_hosts_list = compute_affinity(bench)
    hosts_list = []

    if bench['affinity'] == SCHED_FAIR:
        if sorted_list is False:
            hosts_list = get_fair_hosts_list(affinity_hosts_list, bench['nb-hosts'])
        else:
            hosts_list = get_fair_hosts_list_per_hv(affinity_hosts_list, bench['nb-hosts'])
    else:
        HP.logger.error("Unsupported affinity : %s" % bench['affinity'])

    return hosts_list
dataset/ETHPy150Open redhat-cip/edeploy/src/health-server.py/get_hosts_list_from_affinity/original