CLOUDSTACK-2554: Incorrect compute of minmemory and cpu

23e54bb0 introduced multiple hypervisors support for cpu and memory
overcommit. Here the HypervisorGuru base which determines the min, max
range for the memory for all hypervisors computes the minCpu using the
MemoryOverCommit ratio and minMemory using the CpuOverCommit ratio.

Minor typo/logic issue but massive damage across all HV if enabled ;)

Signed-off-by: Prasanna Santhanam <[email protected]>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/eb65cf08
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/eb65cf08
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/eb65cf08

Branch: refs/heads/2554
Commit: eb65cf0868d7078fe38a5d4206fcd89259396cd9
Parents: 3bf6b52
Author: Prasanna Santhanam <[email protected]>
Authored: Sun May 19 16:12:31 2013 +0530
Committer: Prasanna Santhanam <[email protected]>
Committed: Sun May 19 16:25:21 2013 +0530

----------------------------------------------------------------------
 .../com/cloud/hypervisor/HypervisorGuruBase.java   |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/eb65cf08/server/src/com/cloud/hypervisor/HypervisorGuruBase.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/hypervisor/HypervisorGuruBase.java 
b/server/src/com/cloud/hypervisor/HypervisorGuruBase.java
index ca1644a..ea4fcc1 100644
--- a/server/src/com/cloud/hypervisor/HypervisorGuruBase.java
+++ b/server/src/com/cloud/hypervisor/HypervisorGuruBase.java
@@ -86,9 +86,9 @@ public abstract class HypervisorGuruBase extends AdapterBase 
implements Hypervis
 
         ServiceOffering offering = vmProfile.getServiceOffering();  
         VirtualMachine vm = vmProfile.getVirtualMachine();
-        Long minMemory = (long) 
(offering.getRamSize()/vmProfile.getCpuOvercommitRatio());
-        int  minspeed= 
(int)(offering.getSpeed()/vmProfile.getMemoryOvercommitRatio());
-        int  maxspeed = (offering.getSpeed());
+        Long minMemory = (long) (offering.getRamSize() / 
vmProfile.getMemoryOvercommitRatio());
+        int minspeed = (int) (offering.getSpeed() / 
vmProfile.getCpuOvercommitRatio());
+        int maxspeed = (offering.getSpeed());
         VirtualMachineTO to = new VirtualMachineTO(vm.getId(), 
vm.getInstanceName(), vm.getType(), offering.getCpu(), minspeed, maxspeed,
                 minMemory * 1024l * 1024l, offering.getRamSize() * 1024l * 
1024l, null, null, vm.isHaEnabled(), vm.limitCpuUse(), vm.getVncPassword());
         to.setBootArgs(vmProfile.getBootArgs());

Reply via email to