Updated the vm-placement script to use the data on CPU utilization by the hypervisor

This commit is contained in:
Anton Beloglazov 2012-10-22 17:04:16 +11:00
parent 6cbd066859
commit f05c7c2c4b

View File

@ -57,10 +57,13 @@ for vm in vms:
vms_cpu_usage[vm] = 0
vms_ram_usage = manager.vms_ram_limit(nova, vms)
hosts_cpu_usage_hypervisor = db.select_last_cpu_mhz_for_hosts()
hosts_cpu_usage = {}
hosts_ram_usage = {}
for host, vms in hosts_to_vms.items():
hosts_cpu_usage[host] = sum(vms_cpu_usage[x] for x in vms)
hosts_cpu_usage[host] = hosts_cpu_usage_hypervisor[host] + \
sum(vms_cpu_usage[x] for x in vms)
hosts_ram_usage[host] = manager.host_used_ram(nova, host)