rhtyd commented on a change in pull request #5017:
URL: https://github.com/apache/cloudstack/pull/5017#discussion_r642336350
##########
File path:
server/src/main/java/org/apache/cloudstack/backup/BackupManagerImpl.java
##########
@@ -884,6 +889,18 @@ private void checkStatusOfCurrentlyExecutingBackups() {
}
}
+ @DB
+ public void cleanupBackups() {
+ LOG.debug("Disassociating backup offerings from expunged VMs that have
no more backups");
+ List<VMInstanceVO> destroyedVmsWithOfferings =
vmInstanceDao.listDestroyedVmsWithBackupOfferingAssigned();
+ for(VMInstanceVO instanceVO : destroyedVmsWithOfferings) {
+ List<Backup> backupsForVm =
backupDao.listByVmId(instanceVO.getDataCenterId(), instanceVO.getId());
+ if (CollectionUtils.isEmpty(backupsForVm)) {
+ removeVMFromBackupOffering(instanceVO.getId(), true);
Review comment:
@Pearl1594 should this be put in a try-catch; an exception will fail
this and effectively the `poll`
--
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]