Revision 2688e6bf
b/snf-cyclades-app/synnefo/logic/allocators/default_allocator.py | ||
---|---|---|
80 | 80 |
def backend_score(backend, flavor): |
81 | 81 |
mem_ratio = 1 - (backend.mfree / backend.mtotal) if backend.mtotal else 0 |
82 | 82 |
disk_ratio = 1 - (backend.dfree / backend.dtotal) if backend.dtotal else 0 |
83 |
cpu_ratio = ((backend.pinst_cnt + 1) * 4) / (backend.ctotal * 3) |
|
83 |
if backend.ctotal: |
|
84 |
cpu_ratio = ((backend.pinst_cnt + 1) * 4) / (backend.ctotal * 3) |
|
85 |
else: |
|
86 |
cpu_ratio = 1 |
|
84 | 87 |
return 0.5 * cpu_ratio + 0.5 * (mem_ratio + disk_ratio) |
Also available in: Unified diff