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<nitin.me...@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 <harikrishna.patn...@citrix.com>
Authored: Mon Jun 24 12:09:44 2013 +0530
Committer: Nitin Mehta <nitin.me...@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");
         }
 

Reply via email to