JoaoJandre commented on code in PR #10140: URL: https://github.com/apache/cloudstack/pull/10140#discussion_r2237556196
########## server/src/main/java/org/apache/cloudstack/resource/ResourceCleanupServiceImpl.java: ########## @@ -320,20 +324,33 @@ protected Pair<List<Long>, List<Long>> getFilteredVmIdsForSnapshots(List<Long> v } currentSkippedVmIds.addAll(vmIdsWithActiveVolumeSnapshots); } + + List<BackupVO> backups = backupDao.searchByVmIds(vmIds); + if (CollectionUtils.isNotEmpty(backups)) { + HashSet<Long> vmIdsWithBackups = backups.stream().map(BackupVO::getVmId) + .collect(Collectors.toCollection(HashSet::new)); + if (logger.isDebugEnabled()) { + logger.debug(String.format("Skipping purging VMs with IDs %s as they have backups", + StringUtils.join(vmIdsWithBackups))); + } + currentSkippedVmIds.addAll(vmIdsWithBackups); + } Review Comment: We could make this behavior configurable -- 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