sureshanaparti commented on code in PR #10017:
URL: https://github.com/apache/cloudstack/pull/10017#discussion_r1871052364


##########
engine/schema/src/main/java/org/apache/cloudstack/backup/dao/BackupDaoImpl.java:
##########
@@ -142,6 +168,31 @@ public List<Backup> syncBackups(Long zoneId, Long vmId, 
List<Backup> externalBac
         return listByVmId(zoneId, vmId);
     }
 
+    @Override
+    public Long countBackupsForAccount(long accountId) {
+        SearchCriteria<Long> sc = CountBackupsByAccount.create();
+        sc.setParameters("account", accountId);
+        sc.setParameters("status", Backup.Status.Error, Backup.Status.Failed, 
Backup.Status.Removed, Backup.Status.Expunged);
+        return customSearch(sc, null).get(0);
+    }
+
+    @Override
+    public Long calculateBackupStorageForAccount(long accountId) {
+        SearchCriteria<SumCount> sc = CalculateBackupStorageByAccount.create();
+        sc.setParameters("account", accountId);
+        sc.setParameters("status", Backup.Status.Error, Backup.Status.Failed, 
Backup.Status.Removed, Backup.Status.Expunged);
+        return customSearch(sc, null).get(0).sum;

Review Comment:
   ensure custom searches ^^^ are not null or empty



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