From f05c7c2c4bb0c6a4549dab4b3c4f5ca015a2d5ba Mon Sep 17 00:00:00 2001 From: Anton Beloglazov Date: Mon, 22 Oct 2012 17:04:16 +1100 Subject: [PATCH] Updated the vm-placement script to use the data on CPU utilization by the hypervisor --- vm-placement.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vm-placement.py b/vm-placement.py index 37d2d99..9b3b2df 100755 --- a/vm-placement.py +++ b/vm-placement.py @@ -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)