Skip to content

Commit eb3953f

Browse files
DaanHooglandyadvr
authored andcommitted
server: expunge if flag is set (#2825)
In integration work for CCS I found that the service call UserVmService.destroyVm(long uuid, boolean expunge) does not honour the expunge flag. I traced it down to the implementation VirtualMachineManagerImpl.destroy(String vmUuid, boolean expunge). Testing: manual testing so far, testing will pose some crosscutting challanges as the behaviour and implementation are seperated by about five layers of abstraction.
1 parent 263559c commit eb3953f

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1890,6 +1890,13 @@ public void doInTransactionWithoutResult(final TransactionStatus status) throws
18901890
if (!stateTransitTo(vm, VirtualMachine.Event.DestroyRequested, vm.getHostId())) {
18911891
s_logger.debug("Unable to destroy the vm because it is not in the correct state: " + vm);
18921892
throw new CloudRuntimeException("Unable to destroy " + vm);
1893+
} else {
1894+
if (expunge) {
1895+
if (!stateTransitTo(vm, VirtualMachine.Event.ExpungeOperation, vm.getHostId())) {
1896+
s_logger.debug("Unable to expunge the vm because it is not in the correct state: " + vm);
1897+
throw new CloudRuntimeException("Unable to expunge " + vm);
1898+
}
1899+
}
18931900
}
18941901
} catch (final NoTransitionException e) {
18951902
s_logger.debug(e.getMessage());

0 commit comments

Comments
 (0)