rp- commented on code in PR #13076:
URL: https://github.com/apache/cloudstack/pull/13076#discussion_r3174094781


##########
plugins/storage/volume/linstor/src/main/java/org/apache/cloudstack/storage/datastore/util/LinstorUtil.java:
##########
@@ -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()));

Review Comment:
   this makes sense yes



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to