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


##########
server/src/main/java/com/cloud/api/query/dao/SnapshotJoinDaoImpl.java:
##########
@@ -96,9 +97,27 @@ private void setSnapshotInfoDetailsInResponse(SnapshotJoinVO 
snapshot, SnapshotR
         } else {
             snapshotResponse.setRevertable(snapshotInfo.isRevertable());
             snapshotResponse.setPhysicalSize(snapshotInfo.getPhysicalSize());
+
+            boolean showChainSize = 
SnapshotManager.snapshotShowChainSize.valueIn(snapshot.getDataCenterId());
+            if (showChainSize && snapshotInfo.getParent() != null) {
+                long chainSize = calculateChainSize(snapshotInfo);
+                snapshotResponse.setChainSize(chainSize);
+            }
         }
     }
 
+    private long calculateChainSize(SnapshotInfo snapshotInfo) {

Review Comment:
   @DaanHoogland I'll say without making it complicated, just add the check 
that chain_size is not longer that `snapshot.delta.max`.
   It's not the total size of chain, but it will fail for at least the last 
snapshot if chain_length is somehow bigger than allowed. Let me know if you 
agree and I can make the change.



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