cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ni...@apache.org
Subject [1/2] CLOUDSTACK-3050 XS - Enforce recommended guest OS values for ram Signed off by : nitin mehta<nitin.mehta@citrix.com>
Date Wed, 26 Jun 2013 07:09:55 GMT
Updated Branches:
  refs/heads/master-6-17-stable bc8cd3466 -> 7ba765908


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7ba76590/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer56FP1Resource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer56FP1Resource.java
b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer56FP1Resource.java
index 8e37809..5b343e7 100644
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer56FP1Resource.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer56FP1Resource.java
@@ -120,6 +120,34 @@ public class XenServer56FP1Resource extends XenServer56Resource {
         }
     }
 
+    public long getStaticMax(String os, boolean b, long dynamicMinRam, long dynamicMaxRam){
+        long recommendedValue = CitrixHelper.getXenServer56FP1StaticMax(os, b);
+        if(recommendedValue == 0){
+            s_logger.warn("No recommended value found for dynamic max, setting static max
and dynamic max equal");
+            return dynamicMaxRam;
+        }
+
+        long staticMax = Math.min(recommendedValue, 4l * dynamicMinRam);  // XS constraint
for stability
+        if (dynamicMaxRam > staticMax){ // XS contraint that dynamic max <= static
max
+            s_logger.warn("dynamixMax " + dynamicMaxRam + " cant be greater than static max
" + staticMax + ", can lead to stability issues. Setting static max as much as dynamic max
");
+            return dynamicMaxRam;
+        }
+        return staticMax;
+    }
+
+    public long getStaticMin(String os, boolean b, long dynamicMinRam, long dynamicMaxRam){
+        long recommendedValue = CitrixHelper.getXenServer56FP1StaticMin(os, b);
+        if(recommendedValue == 0){
+            s_logger.warn("No recommended value found for dynamic min");
+            return dynamicMinRam;
+        }
+
+        if(dynamicMinRam < recommendedValue){   // XS contraint that dynamic min >
static min
+            s_logger.warn("Vm is set to dynamixMin " + dynamicMinRam + " less than the recommended
static min " + recommendedValue + ", could lead to stability issues.");
+        }
+        return dynamicMinRam;
+    }
+
     @Override
     protected VM createVmFromTemplate(Connection conn, VirtualMachineTO vmSpec, Host host)
throws XenAPIException, XmlRpcException {
         String guestOsTypeName = getGuestOsType(vmSpec.getOs(), vmSpec.getBootloader() ==
BootloaderType.CD);
@@ -139,9 +167,8 @@ public class XenServer56FP1Resource extends XenServer56Resource {
 
         if (isDmcEnabled(conn, host) && vmSpec.isEnableDynamicallyScaleVm()) {
             //scaling is allowed
-            vmr.memoryStaticMin = mem_128m; //128MB
-            //TODO: Remove hardcoded 8GB and assign proportionate to ServiceOffering and
mem overcommit ratio
-            vmr.memoryStaticMax = 8589934592L; //8GB
+            vmr.memoryStaticMin = getStaticMin(vmSpec.getOs(), vmSpec.getBootloader() ==
BootloaderType.CD, vmSpec.getMinRam(), vmSpec.getMaxRam());
+            vmr.memoryStaticMax = getStaticMax(vmSpec.getOs(), vmSpec.getBootloader() ==
BootloaderType.CD, vmSpec.getMinRam(), vmSpec.getMaxRam());
             vmr.memoryDynamicMin = vmSpec.getMinRam();
             vmr.memoryDynamicMax = vmSpec.getMaxRam();
         } else {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7ba76590/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer56SP2Resource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer56SP2Resource.java
b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer56SP2Resource.java
index 38e1271..7c6443f 100644
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer56SP2Resource.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer56SP2Resource.java
@@ -57,4 +57,33 @@ public class XenServer56SP2Resource extends XenServer56FP1Resource {
         return files;
     }
 
+    @Override
+    public long getStaticMax(String os, boolean b, long dynamicMinRam, long dynamicMaxRam){
+        long recommendedValue = CitrixHelper.getXenServer56SP2StaticMax(os, b);
+        if(recommendedValue == 0){
+            s_logger.warn("No recommended value found for dynamic max, setting static max
and dynamic max equal");
+            return dynamicMaxRam;
+        }
+        long staticMax = Math.min(recommendedValue, 4l * dynamicMinRam);  // XS constraint
for stability
+        if (dynamicMaxRam > staticMax){ // XS contraint that dynamic max <= static
max
+            s_logger.warn("dynamixMax " + dynamicMaxRam + " cant be greater than static max
" + staticMax + ", can lead to stability issues. Setting static max as much as dynamic max
");
+            return dynamicMaxRam;
+        }
+        return staticMax;
+    }
+
+    @Override
+    public long getStaticMin(String os, boolean b, long dynamicMinRam, long dynamicMaxRam){
+        long recommendedValue = CitrixHelper.getXenServer56SP2StaticMin(os, b);
+        if(recommendedValue == 0){
+            s_logger.warn("No recommended value found for dynamic min");
+            return dynamicMinRam;
+        }
+
+        if(dynamicMinRam < recommendedValue){   // XS contraint that dynamic min >
static min
+            s_logger.warn("Vm is set to dynamixMin " + dynamicMinRam + " less than the recommended
static min " + recommendedValue + ", could lead to stability issues");
+        }
+        return dynamicMinRam;
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7ba76590/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer600Resource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer600Resource.java
b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer600Resource.java
index bd8518b..d1d11eb 100644
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer600Resource.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer600Resource.java
@@ -42,6 +42,35 @@ public class XenServer600Resource extends XenServer56FP1Resource {
     protected String getGuestOsType(String stdType, boolean bootFromCD) {
         return CitrixHelper.getXenServer600GuestOsType(stdType, bootFromCD);
     }
+
+    @Override
+    public long getStaticMax(String os, boolean b, long dynamicMinRam, long dynamicMaxRam){
+        long recommendedValue = CitrixHelper.getXenServer600StaticMax(os, b);
+        if(recommendedValue == 0){
+            s_logger.warn("No recommended value found for dynamic max, setting static max
and dynamic max equal");
+            return dynamicMaxRam;
+        }
+        long staticMax = Math.min(recommendedValue, 4l * dynamicMinRam);  // XS constraint
for stability
+        if (dynamicMaxRam > staticMax){ // XS contraint that dynamic max <= static
max
+            s_logger.warn("dynamixMax " + dynamicMaxRam + " cant be greater than static max
" + staticMax + ", can lead to stability issues. Setting static max as much as dynamic max
");
+            return dynamicMaxRam;
+        }
+        return staticMax;
+    }
+
+    @Override
+    public long getStaticMin(String os, boolean b, long dynamicMinRam, long dynamicMaxRam){
+        long recommendedValue = CitrixHelper.getXenServer600StaticMin(os, b);
+        if(recommendedValue == 0){
+            s_logger.warn("No recommended value found for dynamic min");
+            return dynamicMinRam;
+        }
+
+        if(dynamicMinRam < recommendedValue){   // XS contraint that dynamic min >
static min
+            s_logger.warn("Vm is set to dynamixMin " + dynamicMinRam + " less than the recommended
static min " + recommendedValue + ", could lead to stability issues");
+        }
+        return dynamicMinRam;
+    }
    
     @Override
     protected List<File> getPatchFiles() {      

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7ba76590/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer602Resource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer602Resource.java
b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer602Resource.java
index 212bc47..9e442e3 100644
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer602Resource.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer602Resource.java
@@ -56,4 +56,32 @@ public class XenServer602Resource extends XenServer56FP1Resource {
         return files;
     }
 
+    @Override
+    public long getStaticMax(String os, boolean b, long dynamicMinRam, long dynamicMaxRam){
+        long recommendedValue = CitrixHelper.getXenServer602StaticMax(os, b);
+        if(recommendedValue == 0){
+            s_logger.warn("No recommended value found for dynamic max, setting static max
and dynamic max equal");
+            return dynamicMaxRam;
+        }
+        long staticMax = Math.min(recommendedValue, 4l * dynamicMinRam);  // XS constraint
for stability
+        if (dynamicMaxRam > staticMax){ // XS contraint that dynamic max <= static
max
+            s_logger.warn("dynamixMax " + dynamicMaxRam + " cant be greater than static max
" + staticMax + ", can lead to stability issues. Setting static max as much as dynamic max
");
+            return dynamicMaxRam;
+        }
+        return staticMax;
+    }
+
+    @Override
+    public long getStaticMin(String os, boolean b, long dynamicMinRam, long dynamicMaxRam){
+        long recommendedValue = CitrixHelper.getXenServer602StaticMin(os, b);
+        if(recommendedValue == 0){
+            s_logger.warn("No recommended value found for dynamic min");
+            return dynamicMinRam;
+        }
+        if(dynamicMinRam < recommendedValue){   // XS contraint that dynamic min >
static min
+            s_logger.warn("Vm is set to dynamixMin " + dynamicMinRam + " less than the recommended
static min " + recommendedValue + ", could lead to stability issues");
+        }
+        return dynamicMinRam;
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7ba76590/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer610Resource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer610Resource.java
b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer610Resource.java
index bb31136..9ccaea5 100644
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer610Resource.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer610Resource.java
@@ -412,4 +412,34 @@ public class XenServer610Resource extends XenServer56FP1Resource {
             return new MigrateVolumeAnswer(cmd, false, msg, null);
         }
     }
+
+    @Override
+    public long getStaticMax(String os, boolean b, long dynamicMinRam, long dynamicMaxRam){
+        long recommendedValue = CitrixHelper.getXenServer610StaticMax(os, b);
+        if(recommendedValue == 0){
+            s_logger.warn("No recommended value found for dynamic max, setting static max
and dynamic max equal");
+            return dynamicMaxRam;
+        }
+        long staticMax = Math.min(recommendedValue, 4l * dynamicMinRam);  // XS constraint
for stability
+        if (dynamicMaxRam > staticMax){ // XS contraint that dynamic max <= static
max
+            s_logger.warn("dynamixMax " + dynamicMaxRam + " cant be greater than static max
" + staticMax + ", can lead to stability issues. Setting static max as much as dynamic max
");
+            return dynamicMaxRam;
+        }
+        return staticMax;
+    }
+
+    @Override
+    public long getStaticMin(String os, boolean b, long dynamicMinRam, long dynamicMaxRam){
+        long recommendedValue = CitrixHelper.getXenServer610StaticMin(os, b);
+        if(recommendedValue == 0){
+            s_logger.warn("No recommended value found for dynamic min");
+            return dynamicMinRam;
+        }
+
+        if(dynamicMinRam < recommendedValue){   // XS contraint that dynamic min >
static min
+            s_logger.warn("Vm is set to dynamixMin " + dynamicMinRam + " less than the recommended
static min " + recommendedValue + ", could lead to stability issues");
+        }
+        return dynamicMinRam;
+    }
+
 }


Mime
View raw message