Skip to content

Skip the snapshots with Group type in snapshots resource count#12945

Open
sureshanaparti wants to merge 1 commit intoapache:4.22from
shapeblue:fix-snapshots-resurce-count
Open

Skip the snapshots with Group type in snapshots resource count#12945
sureshanaparti wants to merge 1 commit intoapache:4.22from
shapeblue:fix-snapshots-resurce-count

Conversation

@sureshanaparti
Copy link
Copy Markdown
Contributor

@sureshanaparti sureshanaparti commented Apr 1, 2026

Description

This PR skips the snapshots with Group type in snapshots resource count. The snapshots with Group type are part of instance snapshot.

Fixes #12929

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?

@sureshanaparti
Copy link
Copy Markdown
Contributor Author

@blueorangutan package

@blueorangutan
Copy link
Copy Markdown

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

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 1, 2026

Codecov Report

❌ Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 17.60%. Comparing base (131ea9f) to head (bc55b4f).
⚠️ Report is 8 commits behind head on 4.22.

Files with missing lines Patch % Lines
...in/java/com/cloud/storage/dao/SnapshotDaoImpl.java 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##               4.22   #12945   +/-   ##
=========================================
  Coverage     17.60%   17.60%           
- Complexity    15674    15676    +2     
=========================================
  Files          5917     5918    +1     
  Lines        531599   531670   +71     
  Branches      64993    65001    +8     
=========================================
+ Hits          93601    93624   +23     
- Misses       427442   427487   +45     
- Partials      10556    10559    +3     
Flag Coverage Δ
uitests 3.70% <ø> (ø)
unittests 18.68% <0.00%> (+<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.

@DaanHoogland DaanHoogland added this to the 4.22.1 milestone Apr 1, 2026
@blueorangutan
Copy link
Copy Markdown

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

Copy link
Copy Markdown
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

Updates snapshot resource counting to exclude snapshots of type GROUP (which are created as part of VM instance snapshots), so account snapshot resource counts better reflect “volume snapshots” and avoid inflated counts during resource count recalculation (issue #12929).

Changes:

  • Add a snapshot type exclusion filter (snapshot_type != GROUP) to the “count snapshots by account” DAO search.
  • Apply the new filter in countSnapshotsForAccount, used by resource count recalculation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 220 to 225
public Long countSnapshotsForAccount(long accountId) {
SearchCriteria<Long> sc = CountSnapshotsByAccount.create();
sc.setParameters("account", accountId);
sc.setParameters("status", State.Error, State.Destroyed);
sc.setParameters("snapshotTypeNEQ", Snapshot.Type.GROUP.ordinal());
return customSearch(sc, null).get(0);
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

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

Consider adding/adjusting a DAO test to cover the new counting semantics here (excluding Snapshot.Type.GROUP from countSnapshotsForAccount). This method is used during resource count recalculation, so a regression test that GROUP snapshots are not counted (while non-GROUP snapshots are) would help prevent future discrepancies.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

clarify "Volume Snapshots" in the web interface dashboard

4 participants