sureshanaparti commented on code in PR #12481:
URL: https://github.com/apache/cloudstack/pull/12481#discussion_r2712002670
##########
engine/schema/src/main/java/org/apache/cloudstack/storage/datastore/db/SnapshotDataStoreDaoImpl.java:
##########
@@ -78,6 +78,15 @@ public class SnapshotDataStoreDaoImpl extends
GenericDaoBase<SnapshotDataStoreVO
" order by created %s " +
" limit 1";
+ private static final String
GET_PHYSICAL_SIZE_OF_SNAPSHOTS_ON_PRIMARY_BY_ACCOUNT = "SELECT
SUM(s.physical_size) " +
+ "FROM cloud.snapshot_store_ref s " +
+ "LEFT JOIN cloud.snapshots ON s.snapshot_id = snapshots.id " +
+ "WHERE snapshots.account_id = ? " +
+ "AND snapshots.removed IS NULL " +
+ "AND s.state = 'Ready' " +
+ "AND s.store_role = 'Primary' " +
+ "AND NOT EXISTS (SELECT 1 FROM cloud.snapshot_store_ref i WHERE
i.snapshot_id = s.snapshot_id AND i.store_role = 'Image')";
Review Comment:
> Shouldn't we include the size of the snapshot in primary which is present
on secondary as well?
@abh1sar no, the snapshots in primary are deleted when they are backed up on
secondary, but the store_ref record still exists (with 'Ready' state as I
noticed - this record needs to removed or state should be updated to
'Destroyed'. Also, _location_type_ column in snapshots table is not populated,
which should indicate location of the snapshot. - these need more testing and
can break any existing func, so I'll raise separate PR with these
fixes/improvements).
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]