Skip to content

Snapshot state normalization for failure due to malformed secondary storage heuristic - #13411

Open
erikbocks wants to merge 2 commits into
apache:4.22from
scclouds:normalize-snapshot-after-faulty-heuristic
Open

erikbocks wants to merge 2 commits into
apache:4.22from
scclouds:normalize-snapshot-after-faulty-heuristic

Conversation

@erikbocks

Copy link
Copy Markdown
Collaborator

Description

If the environment has a malformed (wrong logic, syntax error, etc.) secondary storage selector heuristic rule, an exception is thrown during its interpretation. The snapshot creation process gets the environment's SNAPSHOT type secondary storage selectors and interprets its heuristic rule, if any was returned. However, this validation does not handle exceptions thrown by the interpreter.

With that, the snapshot record that was created in the Allocated state is never normalized, even though the creation process was finished prematurely due to the interpretation error. Therefore, changes were made to normalize the snapshot state to Error in these cases.

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

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

First, I created a malformed secondary storage selector:

Secondary storage selector creation command
create secondarystorageselector name=a description=a type=SNAPSHOT zoneid=a9a3fc15-008f-48b1-8964-d946104b4b17 heuristicrule="if"

Then, I tried to create a volume snapshot, and validated that it was set to the Allocated state. After applying the changes, I repeated the process and validated that the snapshot was set to the Error state.

@codecov

codecov Bot commented Jun 12, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 15 lines in your changes missing coverage. Please review.
✅ Project coverage is 18.32%. Comparing base (8e933b7) to head (519e072).
⚠️ Report is 229 commits behind head on 4.22.

Files with missing lines Patch % Lines
...om/cloud/storage/snapshot/SnapshotManagerImpl.java 0.00% 15 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               4.22   #13411      +/-   ##
============================================
+ Coverage     17.67%   18.32%   +0.64%     
- Complexity    15792    16642     +850     
============================================
  Files          5922     5939      +17     
  Lines        533167   537798    +4631     
  Branches      65210    65932     +722     
============================================
+ Hits          94246    98527    +4281     
+ Misses       428276   428062     -214     
- Partials      10645    11209     +564     
Flag Coverage Δ
uitests 4.08% <ø> (+0.38%) ⬆️
unittests 19.41% <0.00%> (+0.65%) ⬆️

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

☔ View full report in Codecov by Harness.
📢 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.

@winterhazel

Copy link
Copy Markdown
Member

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@winterhazel 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
Copy Markdown

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

@winterhazel

Copy link
Copy Markdown
Member

Looks good, but I did not test.

@nvazquez nvazquez modified the milestones: 4.22.2, 4.22.3 Nov 9, 2026
@erikbocks erikbocks changed the title Snapshot state normalization for failure due to malformed secondary s… Snapshot state normalization for failure due to malformed secondary storage heuristic rules Nov 13, 2026
@erikbocks erikbocks changed the title Snapshot state normalization for failure due to malformed secondary storage heuristic rules Snapshot state normalization for failure due to malformed secondary storage heuristic Nov 13, 2026
@erikbocks

Copy link
Copy Markdown
Collaborator Author

Hello, @Damans227 and @winterhazel

I moved the storage selection to the try block. Now, limits are decremented by the catch block. Could you review this approach?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Ready

Development

Successfully merging this pull request may close these issues.

5 participants