mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-3703: change service offering of stopped vm on
This commit is contained in:
parent
b39d302888
commit
b21de4006a
|
|
@ -1144,15 +1144,16 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use
|
|||
|
||||
// Verify input parameters
|
||||
VMInstanceVO vmInstance = _vmInstanceDao.findById(vmId);
|
||||
if(vmInstance.getHypervisorType() != HypervisorType.XenServer && vmInstance.getHypervisorType() != HypervisorType.VMware){
|
||||
throw new InvalidParameterValueException("This operation not permitted for this hypervisor of the vm");
|
||||
}
|
||||
|
||||
if(vmInstance.getState().equals(State.Stopped)){
|
||||
upgradeStoppedVirtualMachine(vmId, newServiceOfferingId);
|
||||
return true;
|
||||
}
|
||||
|
||||
if(vmInstance.getHypervisorType() != HypervisorType.XenServer && vmInstance.getHypervisorType() != HypervisorType.VMware){
|
||||
throw new InvalidParameterValueException("This operation not permitted for this hypervisor of the vm");
|
||||
}
|
||||
|
||||
_accountMgr.checkAccess(caller, null, true, vmInstance);
|
||||
|
||||
// Check that the specified service offering ID is valid
|
||||
|
|
|
|||
|
|
@ -272,7 +272,8 @@ public class UserVmManagerTest {
|
|||
// UserContext.current().setEventDetails("Vm Id: "+getId());
|
||||
Account account = (Account) new AccountVO("testaccount", 1L, "networkdomain", (short) 0, "uuid");
|
||||
//AccountVO(String accountName, long domainId, String networkDomain, short type, int regionId)
|
||||
UserContext.registerContext(1, account, null, true);
|
||||
doReturn(VirtualMachine.State.Running).when(_vmInstance).getState();
|
||||
UserContext.registerContext(1, account, null, true);
|
||||
|
||||
when(_vmInstanceDao.findById(anyLong())).thenReturn(_vmInstance);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue