Skip to content

Commit ecfd486

Browse files
committed
CLOUDSTACK-4881:
changeServiceForVirtualMachine API should be used to scale up a stopped vm only
1 parent fa577a4 commit ecfd486

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎server/src/com/cloud/vm/UserVmManagerImpl.java‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -816,8 +816,10 @@ public UserVm upgradeVirtualMachine(UpgradeVMCmd cmd) throws ResourceAllocationE
816816
//UserVmVO vmInstance = _vmDao.findById(vmId);
817817
VMInstanceVO vmInstance = _vmInstanceDao.findById(vmId);
818818
if (vmInstance == null) {
819-
throw new InvalidParameterValueException(
820-
"unable to find a virtual machine with id " + vmId);
819+
throw new InvalidParameterValueException("unable to find a virtual machine with id " + vmId);
820+
}else if (!(vmInstance.getState().equals(State.Stopped))) {
821+
throw new InvalidParameterValueException("Unable to upgrade virtual machine " + vmInstance.toString() + " " + " in state " + vmInstance.getState() +
822+
"; make sure the virtual machine is stopped");
821823
}
822824

823825
_accountMgr.checkAccess(caller, null, true, vmInstance);

0 commit comments

Comments
 (0)