cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aprat...@apache.org
Subject git commit: updated refs/heads/master to 580731c
Date Fri, 12 Apr 2013 10:05:48 GMT
Updated Branches:
  refs/heads/master cbcb83b08 -> 580731ccc


CLOUDSTACK-1534 Disable/Enable-unmanaged/manage cluster is setting CPU overcommit and memory
overcommit ratio to 1 (defalut value).

Signed-off-by: Abhinandan Prateek <aprateek@apache.org>


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

Branch: refs/heads/master
Commit: 580731ccc0b03b54dde544ead30ae44eebc8f2f5
Parents: cbcb83b
Author: Bharat Kumar <bharat.kumar@citrix.com>
Authored: Tue Apr 9 10:27:05 2013 +0530
Committer: Abhinandan Prateek <aprateek@apache.org>
Committed: Fri Apr 12 15:30:02 2013 +0530

----------------------------------------------------------------------
 .../command/admin/cluster/UpdateClusterCmd.java    |   15 +++++++---
 .../com/cloud/resource/ResourceManagerImpl.java    |   22 +++-----------
 2 files changed, 16 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/580731cc/api/src/org/apache/cloudstack/api/command/admin/cluster/UpdateClusterCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/cluster/UpdateClusterCmd.java
b/api/src/org/apache/cloudstack/api/command/admin/cluster/UpdateClusterCmd.java
index 95728dd..c513058 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/cluster/UpdateClusterCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/cluster/UpdateClusterCmd.java
@@ -111,14 +111,14 @@ public class UpdateClusterCmd extends BaseCmd {
         if(cpuovercommitratio != null){
             return Float.parseFloat(cpuovercommitratio);
         }
-        return 1.0f;
+        return null;
     }
 
     public Float getMemoryOvercommitRaito (){
         if (memoryovercommitratio != null){
             return Float.parseFloat(memoryovercommitratio);
         }
-        return 1.0f;
+        return null;
     }
 
     @Override
@@ -127,9 +127,16 @@ public class UpdateClusterCmd extends BaseCmd {
         if (cluster == null) {
             throw new InvalidParameterValueException("Unable to find the cluster by id="
+ getId());
         }
+        if (getMemoryOvercommitRaito() !=null){
+            if ((getMemoryOvercommitRaito().compareTo(1f) < 0)) {
+                throw new InvalidParameterValueException("Memory overcommit ratio  should
be greater than or equal to one");
+            }
+        }
 
-        if ((getMemoryOvercommitRaito().compareTo(1f) < 0) | (getCpuOvercommitRatio().compareTo(1f)
< 0)) {
-            throw new InvalidParameterValueException("Cpu and ram overcommit ratios  should
be greater than one");
+        if (getCpuOvercommitRatio() !=null){
+            if (getCpuOvercommitRatio().compareTo(1f) < 0) {
+                throw new InvalidParameterValueException("Cpu overcommit ratio  should be
greater than or equal to one");
+            }
         }
 
         Cluster result = _resourceService.updateCluster(cluster, getClusterType(), getHypervisor(),
getAllocationState(), getManagedstate(), getMemoryOvercommitRaito(), getCpuOvercommitRatio());

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/580731cc/server/src/com/cloud/resource/ResourceManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/resource/ResourceManagerImpl.java b/server/src/com/cloud/resource/ResourceManagerImpl.java
index 82bca51..c9c3f9c 100755
--- a/server/src/com/cloud/resource/ResourceManagerImpl.java
+++ b/server/src/com/cloud/resource/ResourceManagerImpl.java
@@ -1181,29 +1181,17 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager,
             }
         }
 
-       ClusterDetailsVO memory_detail = _clusterDetailsDao.findDetail(cluster.getId(),"memoryOvercommitRatio");
-       if( memory_detail == null){
-           if (memoryovercommitratio.compareTo(1f) > 0){
-               memory_detail = new ClusterDetailsVO(cluster.getId(),"memoryOvercommitRatio",Float.toString(memoryovercommitratio));
-               _clusterDetailsDao.persist(memory_detail);
-           }
-       }
-       else {
+       if (memoryovercommitratio != null) {
+           ClusterDetailsVO memory_detail = _clusterDetailsDao.findDetail(cluster.getId(),"memoryOvercommitRatio");
            memory_detail.setValue(Float.toString(memoryovercommitratio));
            _clusterDetailsDao.update(memory_detail.getId(),memory_detail);
        }
 
-        ClusterDetailsVO cpu_detail = _clusterDetailsDao.findDetail(cluster.getId(),"cpuOvercommitRatio");
-        if( cpu_detail == null){
-            if (cpuovercommitratio.compareTo(1f) > 0){
-                cpu_detail = new ClusterDetailsVO(cluster.getId(),"cpuOvercommitRatio",Float.toString(cpuovercommitratio));
-                _clusterDetailsDao.persist(cpu_detail);
-            }
-        }
-        else {
+       if (cpuovercommitratio != null) {
+            ClusterDetailsVO cpu_detail = _clusterDetailsDao.findDetail(cluster.getId(),"cpuOvercommitRatio");
             cpu_detail.setValue(Float.toString(cpuovercommitratio));
             _clusterDetailsDao.update(cpu_detail.getId(),cpu_detail);
-        }
+       }
 
 
         if (doUpdate) {


Mime
View raw message