fix(linstor): surface ambiguous template fallbacks and legacy orphan cleanup#13078
Open
jmsperu wants to merge 1 commit intoapache:mainfrom
Open
fix(linstor): surface ambiguous template fallbacks and legacy orphan cleanup#13078jmsperu wants to merge 1 commit intoapache:mainfrom
jmsperu wants to merge 1 commit intoapache:mainfrom
Conversation
…e orphans Two small visibility improvements that make existing template behaviour easier to audit, especially after upgrading from versions that predated the ref-count convention. LinstorUtil.findResourceDefinition When no resource has the exact "_cs-template-for-<rscGrpName>" Aux property, the method silently returned the first resource whose name starts with the requested prefix. With multiple resource groups on a single controller, this can route a clone to the wrong template. Now logs a WARN naming the requested rscGrpName, the fallback resource, and the actual aux properties present. Behaviour unchanged: still returns the first match. Operators can act on the warning by setting the property explicitly or removing the unrelated definition. LinstorStorageAdaptor.deRefOrDeleteResource When deleting a resource that has zero `_cs-template-for-` aux properties AND whose name starts with the template-name prefix the caller is acting on, log an INFO line. These are legacy templates cached before the ref-count convention was introduced — they get picked up by the existing "if expectedProps == 0" branch and deleted. Surfacing them lets operators see how many orphans existed at upgrade time and confirm the cleanup happened.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two small visibility improvements to the LINSTOR template-handling path. Both preserve existing behaviour and only add log output that surfaces conditions operators have currently no easy way to detect.
1. `LinstorUtil.findResourceDefinition` — log on ambiguous fallback
When clone-from-template runs, the method scans for a resource whose name starts with the template prefix AND whose aux properties include `_cs-template-for-`. If no exact-property match exists, the method falls back to the first matching resource by name and returns it silently.
In setups with multiple resource groups on the same controller (or with legacy templates cached before the ref-count convention was added), this fallback can return a template that belongs to the wrong resource group, and the clone produces an unexpected result.
This change keeps the fallback behaviour but logs a WARN naming:
2. `LinstorStorageAdaptor.deRefOrDeleteResource` — log on legacy-template orphan cleanup
The ref-count branch already deletes resources that have zero remaining `_cs-template-for-` aux properties. Two conditions reach this branch:
Currently both look identical in the logs. Operators upgrading from older versions can't tell how many orphan legacy templates were cleaned up.
This change logs an INFO line in the second case, identifying the resource as a legacy template and naming the resource group context. Behaviour unchanged.
Test plan
Why three small PRs
Per the suggestion from earlier review, splitting LINSTOR plugin improvements into focused PRs:
All three target the LINSTOR primary-storage plugin and can be reviewed independently.