You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ah...@apache.org on 2013/06/25 01:51:53 UTC

[17/50] [abbrv] git commit: updated refs/heads/vmsync to 049dd72

CLOUDSTACK-2181: Scale down is allowed when one resource(say cpu) is being scale up and other resource (say ram) is
 being scale down ;but not allowed when both resources are being scaledown
Signed off by : Nitin Mehta<ni...@citrix.com>


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

Branch: refs/heads/vmsync
Commit: 1eb744fa1600f9400e407c6e3615da40b18758c1
Parents: 7767472
Author: Harikrishna Patnala <ha...@citrix.com>
Authored: Mon Jun 24 12:09:44 2013 +0530
Committer: Nitin Mehta <ni...@citrix.com>
Committed: Mon Jun 24 12:09:55 2013 +0530

----------------------------------------------------------------------
 server/src/com/cloud/vm/UserVmManagerImpl.java | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1eb744fa/server/src/com/cloud/vm/UserVmManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java b/server/src/com/cloud/vm/UserVmManagerImpl.java
index 7b3b1bc..66103fb 100755
--- a/server/src/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/com/cloud/vm/UserVmManagerImpl.java
@@ -1160,9 +1160,9 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use
         int currentMemory = currentServiceOffering.getRamSize();
         int currentSpeed = currentServiceOffering.getSpeed();
 
-        if(newSpeed     <= currentSpeed
-           && newMemory <= currentMemory
-           && newCpu    <= currentCpu){
+        // Don't allow to scale when (Any of the new values less than current values) OR (All current and new values are same)
+        if( (newSpeed < currentSpeed || newMemory < currentMemory || newCpu < currentCpu)
+                ||  ( newSpeed == currentSpeed && newMemory == currentMemory && newCpu == currentCpu)){
             throw new InvalidParameterValueException("Only scaling up the vm is supported, new service offering should have both cpu and memory greater than the old values");
         }