Updated Branches: refs/heads/master 71fd0a49e -> d5e497859
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/d5e49785 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/d5e49785 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/d5e49785 Branch: refs/heads/master Commit: d5e497859f770d6e11f603f4c12a041251dbce93 Parents: 71fd0a4 Author: Nitin Mehta <[email protected]> Authored: Mon Dec 2 17:27:13 2013 -0800 Committer: Nitin Mehta <[email protected]> Committed: Mon Dec 2 17:27:13 2013 -0800 ---------------------------------------------------------------------- server/src/com/cloud/vm/UserVmManagerImpl.java | 3 +++ 1 file changed, 3 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d5e49785/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 1d5a187..d3dd356 100755 --- a/server/src/com/cloud/vm/UserVmManagerImpl.java +++ b/server/src/com/cloud/vm/UserVmManagerImpl.java @@ -769,6 +769,9 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir VMInstanceVO vmInstance = _vmInstanceDao.findById(vmId); if (vmInstance == null) { 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);
