Updated Branches: refs/heads/master e135ee3eb -> 2af678902
CS-12972 : cap is per VM , weight is per VCPU Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/2af67890 Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/2af67890 Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/2af67890 Branch: refs/heads/master Commit: 2af67890204c021b98c70d6c7a3c3c7d0f38d9df Parents: e135ee3 Author: anthony <[email protected]> Authored: Thu Jun 14 18:28:33 2012 -0700 Committer: anthony <[email protected]> Committed: Thu Jun 14 18:28:33 2012 -0700 ---------------------------------------------------------------------- .../xen/resource/CitrixResourceBase.java | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/2af67890/core/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java ---------------------------------------------------------------------- diff --git a/core/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java b/core/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java index 4776e54..121675e 100644 --- a/core/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java +++ b/core/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java @@ -941,7 +941,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); @@ -950,11 +950,11 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe } if (vmSpec.getLimitCpuUse()) { - utilization = (int)((speed*0.99) / _host.speed * 100); + utilization = ((long)speed * 100 * vmSpec.getCpus()) / _host.speed ; } vcpuParams.put("weight", Integer.toString(cpuWeight)); - vcpuParams.put("cap", Integer.toString(utilization)); + vcpuParams.put("cap", Long.toString(utilization)); }
