CLOUDSTACK-3703: change service offering of stopped vm on

Conflicts:
	server/test/com/cloud/vm/UserVmManagerTest.java
This commit is contained in:
Harikrishna Patnala 2013-07-27 19:51:02 +05:30 committed by Kishan Kavala
parent 996059ce98
commit a8ad908666
2 changed files with 6 additions and 3 deletions

View File

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

View File

@ -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 {