mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
fix removeUsage for backups (#11522)
This commit is contained in:
parent
cd12fa5848
commit
1efa46cb4d
@ -68,7 +68,7 @@ public class UsageBackupDaoImpl extends GenericDaoBase<UsageBackupVO, Long> impl
|
|||||||
pstmt.setString(1, DateUtil.getDateDisplayString(TimeZone.getTimeZone("GMT"), eventDate));
|
pstmt.setString(1, DateUtil.getDateDisplayString(TimeZone.getTimeZone("GMT"), eventDate));
|
||||||
pstmt.setLong(2, accountId);
|
pstmt.setLong(2, accountId);
|
||||||
pstmt.setLong(3, vmId);
|
pstmt.setLong(3, vmId);
|
||||||
pstmt.setLong(3, backupOfferingId);
|
pstmt.setLong(4, backupOfferingId);
|
||||||
pstmt.executeUpdate();
|
pstmt.executeUpdate();
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
|
|||||||
@ -1927,7 +1927,11 @@ public class BackupManagerImpl extends ManagerBase implements BackupManager {
|
|||||||
for (final VirtualMachine vm : vms) {
|
for (final VirtualMachine vm : vms) {
|
||||||
|
|
||||||
Map<Long, Pair<Long, Long>> backupOfferingToSizeMap = new HashMap<>();
|
Map<Long, Pair<Long, Long>> backupOfferingToSizeMap = new HashMap<>();
|
||||||
for (final Backup backup: backupDao.listByVmId(null, vm.getId())) {
|
List<Backup> backups = backupDao.listByVmId(null, vm.getId());
|
||||||
|
if (backups.isEmpty() && vm.getBackupOfferingId() != null) {
|
||||||
|
backupOfferingToSizeMap.put(vm.getBackupOfferingId(), new Pair<>(0L, 0L));
|
||||||
|
}
|
||||||
|
for (final Backup backup: backups) {
|
||||||
Long backupSize = 0L;
|
Long backupSize = 0L;
|
||||||
Long backupProtectedSize = 0L;
|
Long backupProtectedSize = 0L;
|
||||||
if (Objects.nonNull(backup.getSize())) {
|
if (Objects.nonNull(backup.getSize())) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user