Updated the global manager to handle hosts with no VMs as being idle (0% CPU utilization)

This commit is contained in:
Anton Beloglazov 2012-10-24 14:21:36 +11:00
parent ad07469551
commit 490eb5e463

View File

@ -314,9 +314,9 @@ def execute_underload(config, state, host):
hosts_cpu_usage = {}
hosts_ram_usage = {}
for host, vms in hosts_to_vms.items():
host_cpu_mhz = sum(vms_last_cpu[x] for x in vms) + \
hosts_last_cpu[host]
if host_cpu_mhz > 0:
if vms:
host_cpu_mhz = sum(vms_last_cpu[x] for x in vms) + \
hosts_last_cpu[host]
hosts_cpu_usage[host] = host_cpu_mhz
hosts_ram_usage[host] = host_used_ram(state['nova'], host)
else: