You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ko...@apache.org on 2013/04/15 15:10:16 UTC
[17/50] [abbrv] git commit: updated
refs/heads/cisco-vnmc-api-integration to 7ce45ea
CLOUDSTACK-1534 Disable/Enable-unmanaged/manage cluster is setting CPU overcommit and memory overcommit ratio to 1 (defalut value).
Signed-off-by: Abhinandan Prateek <ap...@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/cisco-vnmc-api-integration
Commit: 580731ccc0b03b54dde544ead30ae44eebc8f2f5
Parents: cbcb83b
Author: Bharat Kumar <bh...@citrix.com>
Authored: Tue Apr 9 10:27:05 2013 +0530
Committer: Abhinandan Prateek <ap...@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) {