CLOUDSTACK-4881:

changeServiceForVirtualMachine API should be used to scale up a stopped vm only
This commit is contained in:
Nitin Mehta 2013-12-02 17:49:07 -08:00
parent fa577a44ce
commit ecfd486938
1 changed files with 4 additions and 2 deletions

View File

@ -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);