cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t..@apache.org
Subject [4/4] git commit: updated refs/heads/master to 85d54cd
Date Sun, 19 May 2013 13:04:42 GMT
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 <tsp@apache.org>


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

Branch: refs/heads/master
Commit: 85d54cd1c088997dd08f0328984bee1a55703636
Parents: 7ea2c95
Author: Prasanna Santhanam <tsp@apache.org>
Authored: Sun May 19 16:12:31 2013 +0530
Committer: Prasanna Santhanam <tsp@apache.org>
Committed: Sun May 19 18:34:27 2013 +0530

----------------------------------------------------------------------
 .../xen/resource/CitrixResourceBase.java           |    5 +----
 .../hypervisor/xen/resource/XcpServerResource.java |   11 +++++++----
 .../com/cloud/hypervisor/HypervisorGuruBase.java   |    6 +++---
 3 files changed, 11 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/85d54cd1/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
index 78bca32..19444cc 100644
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
@@ -3520,10 +3520,7 @@ public abstract class CitrixResourceBase implements ServerResource,
HypervisorRe
      * @throws XenAPIException
      */
     protected void setMemory(Connection conn, VM vm, long minMemsize, long maxMemsize) throws
XmlRpcException, XenAPIException {
-        vm.setMemoryStaticMin(conn, mem_128m);
-        vm.setMemoryDynamicMin(conn, minMemsize);
-        vm.setMemoryDynamicMax(conn, maxMemsize);
-        vm.setMemoryStaticMax(conn, maxMemsize);
+        vm.setMemoryLimits(conn, mem_128m, maxMemsize, minMemsize, maxMemsize);
     }
 
     protected void waitForTask(Connection c, Task task, long pollInterval, long timeout)
throws XenAPIException, XmlRpcException {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/85d54cd1/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XcpServerResource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XcpServerResource.java
b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XcpServerResource.java
index 7df4c46..bf0a408 100644
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XcpServerResource.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XcpServerResource.java
@@ -140,9 +140,12 @@ public class XcpServerResource extends CitrixResourceBase {
      */
     @Override
     protected void setMemory(Connection conn, VM vm, long minMemsize, long maxMemsize) throws
XmlRpcException, XenAPIException {
-        vm.setMemoryStaticMin(conn, mem_32m);
-        vm.setMemoryDynamicMin(conn, minMemsize);
-        vm.setMemoryDynamicMax(conn, maxMemsize);
-        vm.setMemoryStaticMax(conn, maxMemsize);
+        //setMemoryLimits(staticMin, staticMax, dynamicMin, dynamicMax)
+        if (s_logger.isDebugEnabled()) {
+            s_logger.debug("Memory Limits for VM [" + vm.getNameLabel(conn) +
+                    "[staticMin:" + mem_32m + ", staticMax:" + maxMemsize
+                    + ", dynamicMin: " + minMemsize + ", dynamicMax:" + maxMemsize+"]]");
+        }
+        vm.setMemoryLimits(conn, mem_32m, maxMemsize, minMemsize, maxMemsize);
     }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/85d54cd1/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());


Mime
View raw message