Skip to content

fix flasharray template delete leaving its copy on the array - #14855

Open
Damans227 wants to merge 1 commit into
apache:4.22from
Damans227:adaptive-template-delete-npe
Open

Damans227 wants to merge 1 commit into
apache:4.22from
Damans227:adaptive-template-delete-npe

Conversation

@Damans227

Copy link
Copy Markdown
Collaborator

Fixes #14854

Deleting a template never removes its copy from a FlashArray pool. The cleanup runs after the template is marked as removed, so the driver's lookup returns nothing and it crashes before contacting the array. This looks up the template, volume or snapshot including removed rows, and skips the account details if the record is gone, so the delete always reaches the array.

Test:

Register a template, deploy a VM from it on a FlashArray pool, destroy the VM with expunge, delete the template, wait for the storage cleanup job.

Before: crashes, copy left on the array under its original name.

16:42:08,291 DEBUG [c.c.t.TemplateManagerImpl] Evicting TmplPool[14-208-4-type=FIBERWWN; ... providerName=cs-prim-fc-p2::tpl-4-0-2-208; ...]
16:42:08,298 ERROR [o.a.c.s.d.d.AdaptiveDataStoreDriverImpl] Result to volume delete failed with exception java.lang.NullPointerException: Cannot invoke "com.cloud.storage.VMTemplateVO.getAccountId()" because "template" is null

> purevol list --pending
cs-prim-fc-p2::tpl-4-0-2-208   8G

before-log

After: no crash, the delete reaches the array and the copy is renamed for deletion.

16:55:21,164 DEBUG [c.c.t.TemplateManagerImpl] Evicting TmplPool[15-209-3-type=FIBERWWN; ... providerName=cs-prim-fc-p1::tpl-3-0-2-209; ...]
16:55:21,169 DEBUG [o.a.c.s.d.d.AdaptiveDataStoreDriverImpl] Delete volume started

> purevol list --pending
cs-prim-fc-p1::tpl-3-0-2-209-20261125165521   8G

The final destroy step on the array fails on 4.22.1.1 because of the rename and destroy being sent together. That is already fixed on 4.22 by #13049.

array-before-after

Also added unit tests for the lookup with removed and missing records, and for the template delete reaching the array.

@codecov

codecov Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 18.34%. Comparing base (6489766) to head (fbecd53).

Additional details and impacted files
@@            Coverage Diff             @@
##               4.22   #14855    +/-   ##
==========================================
  Coverage     18.34%   18.34%            
- Complexity    16669    16682    +13     
==========================================
  Files          5939     5939            
  Lines        537819   538128   +309     
  Branches      65941    65944     +3     
==========================================
+ Hits          98638    98695    +57     
- Misses       427960   428207   +247     
- Partials      11221    11226     +5     
Flag Coverage Δ
uitests 4.08% <ø> (ø)
unittests 19.43% <100.00%> (-0.01%) ⬇️

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.

@Damans227
Damans227 marked this pull request as ready for review November 25, 2026 18:26

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

None yet

Development

Successfully merging this pull request may close these issues.

1 participant