Skip to content

Conversation

@abh1sar
Copy link
Collaborator

@abh1sar abh1sar commented Jul 29, 2025

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.

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)
  • 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
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

How did you try to break this feature and the system with this change?

@codecov
Copy link

codecov bot commented Jul 29, 2025

Codecov Report

❌ Patch coverage is 6.25000% with 15 lines in your changes missing coverage. Please review.
✅ Project coverage is 16.99%. Comparing base (d693736) to head (9edcf37).
⚠️ Report is 132 commits behind head on main.

Files with missing lines Patch % Lines
...a/com/cloud/api/query/dao/SnapshotJoinDaoImpl.java 0.00% 12 Missing ⚠️
...ache/cloudstack/api/response/SnapshotResponse.java 0.00% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #11313      +/-   ##
============================================
- Coverage     16.99%   16.99%   -0.01%     
- Complexity    14718    14719       +1     
============================================
  Files          5832     5832              
  Lines        517562   517582      +20     
  Branches      62982    62986       +4     
============================================
+ Hits          87985    87988       +3     
- Misses       419644   419661      +17     
  Partials       9933     9933              
Flag Coverage Δ
uitests 3.82% <ø> (-0.01%) ⬇️
unittests 17.95% <6.25%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@abh1sar
Copy link
Collaborator Author

abh1sar commented Jul 29, 2025

@blueorangutan package

@blueorangutan
Copy link

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

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a new chain_size field to snapshot responses that displays the total disk usage of incremental snapshots including their parent snapshots. This addresses the issue where incremental snapshots show misleadingly small physical sizes when their parent snapshots have been deleted from the UI but remain on disk.

  • Introduces a configurable snapshot.show.chain.size setting to control chain size visibility
  • Adds chain size calculation logic that traverses the snapshot parent hierarchy
  • Updates UI components to display the chain size field for snapshots

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
api/src/main/java/org/apache/cloudstack/api/ApiConstants.java Adds CHAIN_SIZE constant for API response field
api/src/main/java/org/apache/cloudstack/api/response/SnapshotResponse.java Adds chainSize field and setter method to snapshot response
server/src/main/java/com/cloud/storage/snapshot/SnapshotManager.java Defines configuration key for enabling chain size display
server/src/main/java/com/cloud/storage/snapshot/SnapshotManagerImpl.java Registers the new configuration key
server/src/main/java/com/cloud/api/query/dao/SnapshotJoinDaoImpl.java Implements chain size calculation logic and response population
ui/src/config/section/storage.js Adds chainsize to snapshot details fields
ui/src/components/view/DetailsTab.vue Adds UI rendering for chain size with GiB formatting
ui/public/locales/en.json Adds label translation for chain size
tools/marvin/setup.py Updates version from snapshot to release

@abh1sar
Copy link
Collaborator Author

abh1sar commented Jul 29, 2025

@blueorangutan ui

@blueorangutan
Copy link

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

@blueorangutan
Copy link

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

@blueorangutan
Copy link

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

Copy link
Contributor

@DaanHoogland DaanHoogland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clgtm, just a question on the co-pilots remark.

Copy link
Contributor

@sureshanaparti sureshanaparti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clgtm

@sureshanaparti
Copy link
Contributor

@blueorangutan package

@blueorangutan
Copy link

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

@blueorangutan
Copy link

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

Copy link
Contributor

@JoaoJandre JoaoJandre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CLGTM, did not test it.

Copy link
Contributor

@slavkap slavkap left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code LGTM, but I don't have a free env. to test it now

@borisstoyanov
Copy link
Contributor

@blueorangutan test

@blueorangutan
Copy link

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

Copy link
Contributor

@borisstoyanov borisstoyanov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, manually checked, chainsize is available in the response and usage records seem to be in line with expectations set at 'keep' argument in setting up recurring snapshots.

@DaanHoogland DaanHoogland merged commit e805e45 into apache:main Jul 31, 2025
25 of 26 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in Apache CloudStack 4.21.0 Jul 31, 2025
@DaanHoogland DaanHoogland deleted the snapshot-chain-size branch July 31, 2025 12:52
@blueorangutan
Copy link

[SF] Trillian test result (tid-13984)
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

dhslove pushed a commit to ablecloud-team/ablestack-cloud that referenced this pull request Aug 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

Snapshot usage reported incorrectly when number of Daily Snapshot less than the snapshot.delta.max

7 participants