Updated Branches:
  refs/heads/4.3 fa577a44c -> ecfd48693

CLOUDSTACK-4881:
changeServiceForVirtualMachine API should be used to scale up a stopped vm only


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

Branch: refs/heads/4.3
Commit: ecfd486938e1bff9569251efbf08913818969738
Parents: fa577a4
Author: Nitin Mehta <[email protected]>
Authored: Mon Dec 2 17:49:07 2013 -0800
Committer: Nitin Mehta <[email protected]>
Committed: Mon Dec 2 17:49:07 2013 -0800

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


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ecfd4869/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 ef9f936..a16f51c 100755
--- a/server/src/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/com/cloud/vm/UserVmManagerImpl.java
@@ -816,8 +816,10 @@ public class UserVmManagerImpl extends ManagerBase 
implements UserVmManager, Vir
         //UserVmVO vmInstance = _vmDao.findById(vmId);
         VMInstanceVO vmInstance = _vmInstanceDao.findById(vmId);
         if (vmInstance == null) {
-            throw new InvalidParameterValueException(
-                    "unable to find a virtual machine with id " + vmId);
+            throw new InvalidParameterValueException("unable to find a virtual 
machine with id " + vmId);
+        }else if (!(vmInstance.getState().equals(State.Stopped))) {
+            throw new InvalidParameterValueException("Unable to upgrade 
virtual machine " + vmInstance.toString() + " " + " in state " + 
vmInstance.getState() +
+                    "; make sure the virtual machine is stopped");
         }
 
         _accountMgr.checkAccess(caller, null, true, vmInstance);

Reply via email to