shwstppr commented on code in PR #11541: URL: https://github.com/apache/cloudstack/pull/11541#discussion_r2348505818
########## engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java: ########## @@ -2041,6 +2047,47 @@ public Boolean doInTransaction(TransactionStatus status) { return BooleanUtils.isTrue(result); } + void persistDomainForKVM(VMInstanceVO vm) { + Long hostId = vm.getHostId(); + String vmName = vm.getName(); + UnmanageInstanceCommand unmanageInstanceCommand; + if (State.Stopped.equals(vm.getState())) { + Pair<Long, Long> clusterAndHostId = findClusterAndHostIdForVm(vm.getLastHostId()); + hostId = clusterAndHostId.second(); + if (hostId == null) { + logger.debug("No previous host found for Instance: {}. " + + "Searching for any available hosts in Zone with ID: {}.", vmName, vm.getDataCenterId()); + List <HostVO> availableHosts = _hostDao.listByDataCenterIdAndHypervisorType(vm.getDataCenterId(), HypervisorType.KVM); Review Comment: @sudo87 you may check but this could cause issue if the storage used is cluster wide and this ends getting a host in a different cluster -- 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. To unsubscribe, e-mail: commits-unsubscr...@cloudstack.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org