mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CLOUDSTACK-3703: change service offering of stopped vm on
Conflicts: server/test/com/cloud/vm/UserVmManagerTest.java
This commit is contained in:
parent
996059ce98
commit
a8ad908666
@ -1139,15 +1139,16 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
|
||||
|
||||
// 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
|
||||
|
||||
@ -313,6 +313,8 @@ public class UserVmManagerTest {
|
||||
// UserContext.current().setEventDetails("Vm Id: "+getId());
|
||||
Account account = new AccountVO("testaccount", 1L, "networkdomain", (short) 0, "uuid");
|
||||
UserVO user = new UserVO(1, "testuser", "password", "firstname", "lastName", "email", "timezone", UUID.randomUUID().toString());
|
||||
//AccountVO(String accountName, long domainId, String networkDomain, short type, int regionId)
|
||||
doReturn(VirtualMachine.State.Running).when(_vmInstance).getState();
|
||||
|
||||
CallContext.register(user, account);
|
||||
try {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user