This is an automated email from the ASF dual-hosted git repository.
rohit pushed a commit to branch 4.11
in repository https://gitbox.apache.org/repos/asf/cloudstack.git
The following commit(s) were added to refs/heads/4.11 by this push:
new eb3953f server: expunge if flag is set (#2825)
eb3953f is described below
commit eb3953f41a167060d62d6fb35abf49b08e75b816
Author: dahn <[email protected]>
AuthorDate: Tue Sep 4 10:08:26 2018 +0200
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.
---
.../orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java | 7 +++++++
1 file changed, 7 insertions(+)
diff --git
a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
index 6f2ae85..682bfb9 100755
--- a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
+++ b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
@@ -1890,6 +1890,13 @@ public class VirtualMachineManagerImpl extends
ManagerBase implements VirtualMac
if (!stateTransitTo(vm,
VirtualMachine.Event.DestroyRequested, vm.getHostId())) {
s_logger.debug("Unable to destroy the vm because it is
not in the correct state: " + vm);
throw new CloudRuntimeException("Unable to destroy " +
vm);
+ } else {
+ if (expunge) {
+ if (!stateTransitTo(vm,
VirtualMachine.Event.ExpungeOperation, vm.getHostId())) {
+ s_logger.debug("Unable to expunge the vm
because it is not in the correct state: " + vm);
+ throw new CloudRuntimeException("Unable to
expunge " + vm);
+ }
+ }
}
} catch (final NoTransitionException e) {
s_logger.debug(e.getMessage());