Skip to content

Commit a8ad908

Browse files
Harikrishna PatnalaKishan Kavala
authored andcommitted
CLOUDSTACK-3703: change service offering of stopped vm on
Conflicts: server/test/com/cloud/vm/UserVmManagerTest.java
1 parent 996059c commit a8ad908

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1139,15 +1139,16 @@ public boolean upgradeVirtualMachine(Long vmId, Long newServiceOfferingId) throw
11391139

11401140
// Verify input parameters
11411141
VMInstanceVO vmInstance = _vmInstanceDao.findById(vmId);
1142-
if(vmInstance.getHypervisorType() != HypervisorType.XenServer && vmInstance.getHypervisorType() != HypervisorType.VMware){
1143-
throw new InvalidParameterValueException("This operation not permitted for this hypervisor of the vm");
1144-
}
11451142

11461143
if (vmInstance.getState().equals(State.Stopped)) {
11471144
upgradeStoppedVirtualMachine(vmId, newServiceOfferingId);
11481145
return true;
11491146
}
11501147

1148+
if(vmInstance.getHypervisorType() != HypervisorType.XenServer && vmInstance.getHypervisorType() != HypervisorType.VMware){
1149+
throw new InvalidParameterValueException("This operation not permitted for this hypervisor of the vm");
1150+
}
1151+
11511152
_accountMgr.checkAccess(caller, null, true, vmInstance);
11521153

11531154
// Check that the specified service offering ID is valid

‎server/test/com/cloud/vm/UserVmManagerTest.java‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,8 @@ public void testScaleVMF1() throws Exception {
313313
// UserContext.current().setEventDetails("Vm Id: "+getId());
314314
Account account = new AccountVO("testaccount", 1L, "networkdomain", (short) 0, "uuid");
315315
UserVO user = new UserVO(1, "testuser", "password", "firstname", "lastName", "email", "timezone", UUID.randomUUID().toString());
316+
//AccountVO(String accountName, long domainId, String networkDomain, short type, int regionId)
317+
doReturn(VirtualMachine.State.Running).when(_vmInstance).getState();
316318

317319
CallContext.register(user, account);
318320
try {

0 commit comments

Comments
 (0)