Revision adf766e9

b/snf-cyclades-app/synnefo/logic/allocators/default_allocator.py
78 78

  
79 79

  
80 80
def backend_score(backend, flavor):
81
    mem_ratio = 1 - (backend.mfree / backend.mtotal)
82
    disk_ratio = 1 - (backend.dfree / backend.dtotal)
81
    mem_ratio = 1 - (backend.mfree / backend.mtotal) if backend.mtotal else 0
82
    disk_ratio = 1 - (backend.dfree / backend.dtotal) if backend.dtotal else 0
83 83
    cpu_ratio = ((backend.pinst_cnt + 1) * 4) / (backend.ctotal * 3)
84 84
    return 0.5 * cpu_ratio + 0.5 * (mem_ratio + disk_ratio)

Also available in: Unified diff