From a8e7d7b1102c288459428caa5c628149b2cba344 Mon Sep 17 00:00:00 2001 From: anthony Date: Thu, 14 Jun 2012 17:50:05 -0700 Subject: [PATCH] CS-12972 : cap is per domain/VM --- .../cloud/hypervisor/xen/resource/CitrixResourceBase.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java b/core/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java index eab97f98ead..e08836bb5d0 100755 --- a/core/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java +++ b/core/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java @@ -822,7 +822,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe if (speed != null) { int cpuWeight = _maxWeight; //cpu_weight - int utilization = 0; // max CPU cap, default is unlimited + long utilization = 0; // max CPU cap, default is unlimited // weight based allocation cpuWeight = (int)((speed*0.99) / _host.speed * _maxWeight); @@ -831,11 +831,11 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe } if (vmSpec.getLimitCpuUse()) { - utilization = (int)((speed*0.99) / _host.speed * 100); + utilization = (((long)speed * vmSpec.getCpus() * 100 ) / _host.speed); } vcpuParams.put("weight", Integer.toString(cpuWeight)); - vcpuParams.put("cap", Integer.toString(utilization)); + vcpuParams.put("cap", Long.toString(utilization)); }