abh1sar commented on code in PR #10140:
URL: https://github.com/apache/cloudstack/pull/10140#discussion_r2230365019


##########
server/src/main/java/org/apache/cloudstack/backup/BackupManagerImpl.java:
##########
@@ -406,9 +501,12 @@ public boolean removeVMFromBackupOffering(final Long vmId, 
final boolean forced)
                 }
             }
             if ((result || forced) && vmInstanceDao.update(vm.getId(), vm)) {
-                
UsageEventUtils.publishUsageEvent(EventTypes.EVENT_VM_BACKUP_OFFERING_REMOVE, 
vm.getAccountId(), vm.getDataCenterId(), vm.getId(),
-                        "Backup-" + vm.getHostName() + "-" + vm.getUuid(), 
vm.getBackupOfferingId(), null, null,
-                        Backup.class.getSimpleName(), vm.getUuid());
+                final List<Backup> backups = backupDao.listByVmId(null, 
vm.getId());
+                if (backups.size() == 0) {
+                    
UsageEventUtils.publishUsageEvent(EventTypes.EVENT_VM_BACKUP_OFFERING_REMOVE, 
vm.getAccountId(), vm.getDataCenterId(), vm.getId(),
+                            "Backup-" + vm.getHostName() + "-" + vm.getUuid(), 
backupOfferingId, null, null,
+                            Backup.class.getSimpleName(), vm.getUuid());
+                }

Review Comment:
   `EVENT_VM_BACKUP_OFFERING_REMOVED_AND_BACKUPS_DELETED` even is tracked by 
the usage server instead of `EVENT_VM_BACKUP_OFFERING_REMOVE`.
   It should be `EVENT_VM_BACKUP_OFFERING_REMOVED_AND_BACKUPS_DELETED` here as 
well



##########
server/src/main/java/com/cloud/server/ManagementServerImpl.java:
##########
@@ -1036,6 +1037,8 @@ public class ManagementServerImpl extends ManagerBase 
implements ManagementServe
     @Inject
     StoragePoolTagsDao storagePoolTagsDao;
     @Inject
+    BackupManager backupManager;

Review Comment:
   Done



-- 
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

Reply via email to