Skip to content

Fix snapshot chaining on Xen#12597

Open
JoaoJandre wants to merge 2 commits intoapache:4.22from
scclouds:fix-snapshot-chain-on-xen
Open

Fix snapshot chaining on Xen#12597
JoaoJandre wants to merge 2 commits intoapache:4.22from
scclouds:fix-snapshot-chain-on-xen

Conversation

@JoaoJandre
Copy link
Contributor

Description

This PR fixes #12524.

After the introduction of the Hidden state, the snapshot chain calculation no longer works as expected for XenServer as it does not consider hidden snapshots as part of the chain, possibly leading to unending chains. This PR fixes this issue by adding the hidden snapshots to the chain calculation.

This PR also fixes a regression introduced in commit d700e2d which made snapshot deletion impossible.

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?

In an environment using XCP-ng, I set snapshot.delta.max to 3 and followed the steps below:

  1. Create 3 volume snapshots
  2. Delete the oldest volume snapshot
  3. Create a new volume snapshot

Before the changes, the new snapshot would be part of the old chain. With the changes, the last snapshot is a full snapshot that is not part of the old chain.

@sureshanaparti
Copy link
Contributor

@blueorangutan package

@codecov
Copy link

codecov bot commented Feb 5, 2026

Codecov Report

❌ Patch coverage is 5.88235% with 16 lines in your changes missing coverage. Please review.
✅ Project coverage is 17.62%. Comparing base (b869913) to head (1e1e7a9).

Files with missing lines Patch % Lines
...storage/datastore/db/SnapshotDataStoreDaoImpl.java 0.00% 16 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##               4.22   #12597   +/-   ##
=========================================
  Coverage     17.62%   17.62%           
- Complexity    15663    15665    +2     
=========================================
  Files          5915     5915           
  Lines        531171   531186   +15     
  Branches      64938    64938           
=========================================
+ Hits          93601    93608    +7     
- Misses       427031   427037    +6     
- Partials      10539    10541    +2     
Flag Coverage Δ
uitests 3.71% <ø> (ø)
unittests 18.69% <5.88%> (+<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.

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

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 fixes issue #12524 where the snapshot.delta.max configuration was not being respected on XenServer after the introduction of the Hidden state. The fix ensures that hidden snapshots are properly considered when calculating snapshot chain length, preventing unending snapshot chains. It also resolves a regression in snapshot deletion by using the correct NOTIN operator instead of NEQ when excluding multiple states.

Changes:

  • Modified snapshot chain calculation to include Hidden state snapshots alongside Ready state snapshots
  • Added new DAO method to query snapshots by multiple states using the IN operator
  • Fixed snapshot deletion regression by properly using NOTIN operator for multiple state exclusion

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
DefaultSnapshotStrategy.java Updated getSnapshotImageStoreRef to include Hidden snapshots in chain calculation by using the new multi-state query method
SnapshotDataStoreDaoImpl.java Added search builders for NOTIN and IN operations, implemented new multi-state query method, fixed snapshot deletion query
SnapshotDataStoreDao.java Added interface method signature for querying snapshots by multiple states

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

@blueorangutan
Copy link

Packaging result [SF]: ✖️ el8 ✖️ el9 ✖️ debian ✖️ suse15. SL-JID 16711

@JoaoJandre
Copy link
Contributor Author

@blueorangutan package

@blueorangutan
Copy link

@JoaoJandre 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 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 16712

@DaanHoogland
Copy link
Contributor

@blueorangutan test ol9 xcpng83

@blueorangutan
Copy link

@DaanHoogland a [SL] Trillian-Jenkins test job (ol9 mgmt + xcpng83) has been kicked to run smoke tests

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.

4 participants