sureshanaparti commented on a change in pull request #4644:
URL: https://github.com/apache/cloudstack/pull/4644#discussion_r626496552
##########
File path: server/src/main/java/com/cloud/ha/HighAvailabilityManagerImpl.java
##########
@@ -680,31 +685,51 @@ public void cancelDestroy(VMInstanceVO vm, Long hostId) {
_haDao.delete(vm.getId(), WorkType.Destroy);
}
+ private void stopVMWithCleanup(VirtualMachine vm, VirtualMachine.State
state) throws OperationTimedoutException, ResourceUnavailableException {
+ if (VirtualMachine.State.Running.equals(state)) {
+ _itMgr.advanceStop(vm.getUuid(), true);
+ }
+ }
+
+ private void destroyVM(VirtualMachine vm, boolean expunge) throws
OperationTimedoutException, AgentUnavailableException {
+ s_logger.info("Destroying " + vm.toString());
+ if (VirtualMachine.Type.ConsoleProxy.equals(vm.getType())) {
+ consoleProxyManager.destroyProxy(vm.getId());
+ } else if
(VirtualMachine.Type.SecondaryStorageVm.equals(vm.getType())) {
+ secondaryStorageVmManager.destroySecStorageVm(vm.getId());
+ } else {
+ _itMgr.destroy(vm.getUuid(), expunge);
+ }
+ }
+
protected Long destroyVM(final HaWorkVO work) {
final VirtualMachine vm = _itMgr.findById(work.getInstanceId());
- s_logger.info("Destroying " + vm.toString());
+ if (vm == null) {
+ s_logger.info("No longer can find VM " + work.getInstanceId() + ".
Throwing away " + work);
+ return null;
+ }
+ boolean expunge =
VirtualMachine.Type.SecondaryStorageVm.equals(vm.getType())
Review comment:
```suggestion
boolean expungeSystemVM =
VirtualMachine.Type.SecondaryStorageVm.equals(vm.getType())
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]