-
Notifications
You must be signed in to change notification settings - Fork 1.3k
fix(linstor): verify resource deletion completes; warn if stuck in DELETING #13076
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -401,6 +401,57 @@ public static List<ResourceDefinition> getRDListStartingWith(DevelopersApi api, | |||||||||||||||||||||
| .collect(Collectors.toList()); | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| /** | ||||||||||||||||||||||
| * Default per-call timeout for {@link #waitForResourceDefinitionDeleted}. Long enough for a | ||||||||||||||||||||||
| * healthy LINSTOR controller to finish a normal delete; short enough not to block the calling | ||||||||||||||||||||||
| * agent thread for too long if the delete is genuinely stuck. | ||||||||||||||||||||||
| */ | ||||||||||||||||||||||
| public static final long DEFAULT_RD_DELETE_VERIFY_TIMEOUT_MILLIS = 30_000L; | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| /** | ||||||||||||||||||||||
| * Returns {@code true} if the named resource definition is no longer present on the LINSTOR | ||||||||||||||||||||||
| * controller. Used after a {@code resourceDefinitionDelete} to verify the delete actually | ||||||||||||||||||||||
| * completed (LINSTOR can return success on the API call while the resource lingers in | ||||||||||||||||||||||
| * DELETING state due to peer issues, lost quorum, or down satellites). | ||||||||||||||||||||||
| */ | ||||||||||||||||||||||
| public static boolean isResourceDefinitionGone(DevelopersApi api, String rscName) throws ApiException { | ||||||||||||||||||||||
| List<ResourceDefinition> all = api.resourceDefinitionList(null, false, null, null, null); | ||||||||||||||||||||||
| if (all == null) { | ||||||||||||||||||||||
| return true; | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
| return all.stream().noneMatch(rd -> rscName.equalsIgnoreCase(rd.getName())); | ||||||||||||||||||||||
|
Comment on lines
+418
to
+422
|
||||||||||||||||||||||
| List<ResourceDefinition> all = api.resourceDefinitionList(null, false, null, null, null); | |
| if (all == null) { | |
| return true; | |
| } | |
| return all.stream().noneMatch(rd -> rscName.equalsIgnoreCase(rd.getName())); | |
| List<ResourceDefinition> matches = api.resourceDefinitionList(Collections.singletonList(rscName), false, null, null, null); | |
| if (matches == null || matches.isEmpty()) { | |
| return true; | |
| } | |
| return matches.stream().noneMatch(rd -> rscName.equalsIgnoreCase(rd.getName())); |
Copilot
AI
Apr 28, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New delete-verification behavior in waitForResourceDefinitionDeleted / isResourceDefinitionGone isn’t covered by the existing LinstorUtilTest suite. Please add unit tests for (a) confirmed-gone case, and (b) timeout/exception paths (ideally without introducing real sleeps) so regressions in the polling logic are caught in CI.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DEFAULT_RD_DELETE_VERIFY_TIMEOUT_MILLISJavadoc mentions "the calling agent thread", but this constant is also used on the management-server side (e.g.,LinstorPrimaryDataStoreDriverImpl). Consider rewording to "calling thread" (or mention both contexts) to keep the comment accurate.