You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by "abh1sar (via GitHub)" <gi...@apache.org> on 2025/07/29 02:39:04 UTC

[PR] Show chain size in snapshot response for incremental snapshots [cloudstack]

abh1sar opened a new pull request, #11313:
URL: https://github.com/apache/cloudstack/pull/11313

   ### Description
   
   This PR fixes #9416 
   
   When a parent (full) snapshot of an incremental snapshot is deleted in CloudStack, it is removed from the UI/API but not from disk if it has dependent snapshots. As a result, the physical size reported for the incremental snapshot is very small, even though the actual data resides in its parent, which still consumes disk space. From the user’s perspective, there will be a mismatch between the physical size shown in CloudStack and the actual storage usage on disk.
   
   This PR introduces `chain_size` as a new filed in snapshot response for incremental snapshots. The chain_size represents the total disk usage of the snapshot chain, calculated as the sum of the physical size of the snapshot and all its parent snapshots. This provides a more accurate representation of actual storage consumed and improves transparency for users.
   This feature can be enabled by the setting `snapshot.show.chain.size`.
   
   <!--- Describe your changes in DETAIL - And how has behaviour functionally changed. -->
   
   <!-- For new features, provide link to FS, dev ML discussion etc. -->
   <!-- In case of bug fix, the expected and actual behaviours, steps to reproduce. -->
   
   <!-- When "Fixes: #<id>" is specified, the issue/PR will automatically be closed when this PR gets merged -->
   <!-- For addressing multiple issues/PRs, use multiple "Fixes: #<id>" -->
   <!-- Fixes: # -->
   
   <!--- ******************************************************************************* -->
   <!--- NOTE: AUTOMATION USES THE DESCRIPTIONS TO SET LABELS AND PRODUCE DOCUMENTATION. -->
   <!--- PLEASE PUT AN 'X' in only **ONE** box -->
   <!--- ******************************************************************************* -->
   
   ### Types of changes
   
   - [ ] Breaking change (fix or feature that would cause existing functionality to change)
   - [ ] New feature (non-breaking change which adds functionality)
   - [ ] Bug fix (non-breaking change which fixes an issue)
   - [x] Enhancement (improves an existing feature and functionality)
   - [ ] Cleanup (Code refactoring and cleanup, that may add test cases)
   - [ ] build/CI
   - [ ] test (unit or integration test code)
   
   ### Feature/Enhancement Scale or Bug Severity
   
   #### Feature/Enhancement Scale
   
   - [ ] Major
   - [x] Minor
   
   #### Bug Severity
   
   - [ ] BLOCKER
   - [ ] Critical
   - [ ] Major
   - [ ] Minor
   - [ ] Trivial
   
   ### Screenshots (if appropriate):
   
   ### How Has This Been Tested?
   
   <!-- Please describe in detail how you tested your changes. -->
   <!-- Include details of your testing environment, and the tests you ran to -->
   
   #### How did you try to break this feature and the system with this change?
   
   <!-- see how your change affects other areas of the code, etc. -->
   
   <!-- Please read the [CONTRIBUTING](https://github.com/apache/cloudstack/blob/main/CONTRIBUTING.md) document -->
   


-- 
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-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Show chain size in snapshot response for incremental snapshots [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #11313:
URL: https://github.com/apache/cloudstack/pull/11313#issuecomment-3141717320

   <b>[SF] Trillian test result (tid-13984)</b>
   Environment: kvm-ol8 (x2), Advanced Networking with Mgmt server ol8
   Total time taken: 57417 seconds
   Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr11313-t13984-kvm-ol8.zip
   Smoke tests completed. 145 look OK, 0 have errors, 0 did not run
   Only failed and skipped tests results shown below:
   
   
   Test | Result | Time (s) | Test File
   --- | --- | --- | ---
   


-- 
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-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Show chain size in snapshot response for incremental snapshots [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #11313:
URL: https://github.com/apache/cloudstack/pull/11313#issuecomment-3130765838

   Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 14429


-- 
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-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Show chain size in snapshot response for incremental snapshots [cloudstack]

Posted by "borisstoyanov (via GitHub)" <gi...@apache.org>.
borisstoyanov commented on PR #11313:
URL: https://github.com/apache/cloudstack/pull/11313#issuecomment-3138854631

   @blueorangutan test


-- 
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-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Show chain size in snapshot response for incremental snapshots [cloudstack]

Posted by "DaanHoogland (via GitHub)" <gi...@apache.org>.
DaanHoogland commented on code in PR #11313:
URL: https://github.com/apache/cloudstack/pull/11313#discussion_r2239816046


##########
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:
   yes, good points.



-- 
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-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Show chain size in snapshot response for incremental snapshots [cloudstack]

Posted by "sureshanaparti (via GitHub)" <gi...@apache.org>.
sureshanaparti commented on PR #11313:
URL: https://github.com/apache/cloudstack/pull/11313#issuecomment-3135795289

   @blueorangutan package


-- 
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-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Show chain size in snapshot response for incremental snapshots [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #11313:
URL: https://github.com/apache/cloudstack/pull/11313#issuecomment-3138860969

   @borisstoyanov a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests


-- 
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-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Show chain size in snapshot response for incremental snapshots [cloudstack]

Posted by "abh1sar (via GitHub)" <gi...@apache.org>.
abh1sar commented on code in PR #11313:
URL: https://github.com/apache/cloudstack/pull/11313#discussion_r2239691675


##########
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:
   Looks like it is not as trivial. What about we drop the check from here? I assume framework would have checks so that the chain doesn't go on infinetly. 



-- 
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-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Show chain size in snapshot response for incremental snapshots [cloudstack]

Posted by "DaanHoogland (via GitHub)" <gi...@apache.org>.
DaanHoogland merged PR #11313:
URL: https://github.com/apache/cloudstack/pull/11313


-- 
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-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Show chain size in snapshot response for incremental snapshots [cloudstack]

Posted by "abh1sar (via GitHub)" <gi...@apache.org>.
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.



-- 
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-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Show chain size in snapshot response for incremental snapshots [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #11313:
URL: https://github.com/apache/cloudstack/pull/11313#issuecomment-3130659970

   @abh1sar a Jenkins job has been kicked to build UI QA env. I'll keep you posted as I make progress.


-- 
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-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Show chain size in snapshot response for incremental snapshots [cloudstack]

Posted by "abh1sar (via GitHub)" <gi...@apache.org>.
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-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Show chain size in snapshot response for incremental snapshots [cloudstack]

Posted by "JoaoJandre (via GitHub)" <gi...@apache.org>.
JoaoJandre commented on code in PR #11313:
URL: https://github.com/apache/cloudstack/pull/11313#discussion_r2239534050


##########
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:
   `snapshot.delta.max` might be changed to a smaller number, this is one way of having a longer chain size than the configuration. I think we can set a limit but it should be something like 10 times the chain size.



-- 
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-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Show chain size in snapshot response for incremental snapshots [cloudstack]

Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #11313:
URL: https://github.com/apache/cloudstack/pull/11313#issuecomment-3130402708

   ## [Codecov](https://app.codecov.io/gh/apache/cloudstack/pull/11313?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :white_check_mark: All modified and coverable lines are covered by tests.
   :white_check_mark: Project coverage is 3.82%. Comparing base ([`d693736`](https://app.codecov.io/gh/apache/cloudstack/commit/d693736ee822bd10f49f2a9fbd6d30449fda57fc?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`7b85ea1`](https://app.codecov.io/gh/apache/cloudstack/commit/7b85ea1fb3322ac1900d5b2089d58fd007b3031d?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   :warning: Report is 1 commits behind head on main.
   > :exclamation:  There is a different number of reports uploaded between BASE (d693736) and HEAD (7b85ea1). Click for more details.
   > 
   > <details><summary>HEAD has 1 upload less than BASE</summary>
   >
   >| Flag | BASE (d693736) | HEAD (7b85ea1) |
   >|------|------|------|
   >|unittests|1|0|
   ></details>
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   ```diff
   @@              Coverage Diff              @@
   ##               main   #11313       +/-   ##
   =============================================
   - Coverage     16.99%    3.82%   -13.18%     
   =============================================
     Files          5832      432     -5400     
     Lines        517562    34897   -482665     
     Branches      62982     6294    -56688     
   =============================================
   - Hits          87985     1334    -86651     
   + Misses       419644    33403   -386241     
   + Partials       9933      160     -9773     
   ```
   
   | [Flag](https://app.codecov.io/gh/apache/cloudstack/pull/11313/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [uitests](https://app.codecov.io/gh/apache/cloudstack/pull/11313/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `3.82% <ø> (ø)` | |
   | [unittests](https://app.codecov.io/gh/apache/cloudstack/pull/11313/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
   </details>
   
   [:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/cloudstack/pull/11313?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
   - :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>


-- 
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-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Show chain size in snapshot response for incremental snapshots [cloudstack]

Posted by "JoaoJandre (via GitHub)" <gi...@apache.org>.
JoaoJandre commented on code in PR #11313:
URL: https://github.com/apache/cloudstack/pull/11313#discussion_r2243268015


##########
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:
   Yes there should not be a cyclical chain ever, and if there is, this is not the only point in the code where it would break. We could map an issue to deal with this eventually.



-- 
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-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Show chain size in snapshot response for incremental snapshots [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #11313:
URL: https://github.com/apache/cloudstack/pull/11313#issuecomment-3135798292

   @sureshanaparti a [SL] Jenkins job has been kicked to build packages. It will be bundled with  KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.


-- 
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-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Show chain size in snapshot response for incremental snapshots [cloudstack]

Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #11313:
URL: https://github.com/apache/cloudstack/pull/11313#discussion_r2238386706


##########
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:
   The calculateChainSize method traverses the entire snapshot chain without cycle detection. In the case of corrupted data or circular references, this could lead to infinite loops. Consider adding a maximum depth limit or cycle detection mechanism.



##########
ui/src/components/view/DetailsTab.vue:
##########
@@ -87,6 +87,11 @@
               {{ parseFloat(dataResource.virtualsize / (1024.0 * 1024.0 * 1024.0)).toFixed(2) }} GiB
             </div>
           </div>
+          <div v-else-if="$route.meta.name === 'snapshot' && item === 'chainsize'">
+            <div>
+              {{ parseFloat(dataResource.chainsize / (1024.0 * 1024.0 * 1024.0)).toFixed(2) }} GiB

Review Comment:
   The conversion factor (1024.0 * 1024.0 * 1024.0) is duplicated from the physicalsize and virtualsize formatting above. Consider extracting this magic number into a constant or utility function to improve maintainability.



##########
server/src/main/java/com/cloud/storage/snapshot/SnapshotManager.java:
##########
@@ -61,6 +61,10 @@ public interface SnapshotManager extends Configurable {
     ConfigKey<Integer> snapshotDeltaMax = new ConfigKey<>(Integer.class, "snapshot.delta.max", "Snapshots", "16", "Max delta snapshots between two full snapshots. " +
             "Only valid for KVM and XenServer.", true, ConfigKey.Scope.Global, null);
 
+    ConfigKey<Boolean> snapshotShowChainSize = new ConfigKey<>(Boolean.class, "snapshot.show.chain.size", "Snapshots", "true",

Review Comment:
   [nitpick] The default value for snapshotShowChainSize is set to "true", which could impact performance for systems with deep snapshot chains. Consider defaulting to "false" to be conservative and require explicit opt-in for this potentially expensive feature.
   ```suggestion
       ConfigKey<Boolean> snapshotShowChainSize = new ConfigKey<>(Boolean.class, "snapshot.show.chain.size", "Snapshots", "false",
   ```



##########
tools/marvin/setup.py:
##########
@@ -27,7 +27,7 @@
         raise RuntimeError("python setuptools is required to build Marvin")
 
 
-VERSION = "4.21.0.0-SNAPSHOT"
+VERSION = "4.21.0.0"

Review Comment:
   This version change from "4.21.0.0-SNAPSHOT" to "4.21.0.0" appears unrelated to the snapshot chain size feature and should likely be in a separate commit or PR focused on release preparation.
   ```suggestion
   VERSION = "4.21.0.0-SNAPSHOT"
   ```



-- 
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-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Show chain size in snapshot response for incremental snapshots [cloudstack]

Posted by "DaanHoogland (via GitHub)" <gi...@apache.org>.
DaanHoogland commented on code in PR #11313:
URL: https://github.com/apache/cloudstack/pull/11313#discussion_r2238910149


##########
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:
   I think we would rather get the chain size (as opposed to the total size of the chain) and check that the actual chain is not longer. Not sure if there is a way of getting that that is not the same method as following it...



-- 
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-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Show chain size in snapshot response for incremental snapshots [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #11313:
URL: https://github.com/apache/cloudstack/pull/11313#issuecomment-3136079596

   Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 14471


-- 
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-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Show chain size in snapshot response for incremental snapshots [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #11313:
URL: https://github.com/apache/cloudstack/pull/11313#issuecomment-3130691550

   UI build: :heavy_check_mark:
   Live QA URL: https://qa.cloudstack.cloud/simulator/pr/11313 (QA-JID-696)


-- 
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-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Show chain size in snapshot response for incremental snapshots [cloudstack]

Posted by "DaanHoogland (via GitHub)" <gi...@apache.org>.
DaanHoogland commented on code in PR #11313:
URL: https://github.com/apache/cloudstack/pull/11313#discussion_r2239404450


##########
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:
   We could add a safety margin of one or two so during coalescing it doesn’t fail, but I think it makes sense to enforce some kind of bounds checking. I think it will complicate things a bit though as we also need to handle the exceptional situation of a too long chain. in general I agree.



-- 
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-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Show chain size in snapshot response for incremental snapshots [cloudstack]

Posted by "abh1sar (via GitHub)" <gi...@apache.org>.
abh1sar commented on PR #11313:
URL: https://github.com/apache/cloudstack/pull/11313#issuecomment-3130657600

   @blueorangutan ui


-- 
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-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Show chain size in snapshot response for incremental snapshots [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #11313:
URL: https://github.com/apache/cloudstack/pull/11313#issuecomment-3130565894

   @abh1sar a [SL] Jenkins job has been kicked to build packages. It will be bundled with  KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.


-- 
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-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Show chain size in snapshot response for incremental snapshots [cloudstack]

Posted by "abh1sar (via GitHub)" <gi...@apache.org>.
abh1sar commented on PR #11313:
URL: https://github.com/apache/cloudstack/pull/11313#issuecomment-3130563163

   @blueorangutan package


-- 
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-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org