abh1sar commented on code in PR #10140: URL: https://github.com/apache/cloudstack/pull/10140#discussion_r2238140344
########## 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: I'd prefer leaving it as non-configurable. VM entry should not be purged if backups are present. Backup framework looks up the VM at many places in code, and purging can make the backups unusable within CloudStack. -- 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