JoaoJandre commented on code in PR #8394:
URL: https://github.com/apache/cloudstack/pull/8394#discussion_r1436970078


##########
framework/jobs/src/main/java/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java:
##########
@@ -1128,6 +1139,65 @@ public void 
doInTransactionWithoutResult(TransactionStatus status) {
         }
     }
 
+    /*
+    Cleanup Resources in transition state and move them to appropriate state
+    This will allow other operation on the resource, instead of being stuck in 
transition state
+     */
+    protected boolean cleanupResources(AsyncJobVO job) {
+        try {
+            ApiCommandResourceType resourceType = 
ApiCommandResourceType.fromString(job.getInstanceType());
+            if (resourceType == null) {
+                s_logger.warn("Unknown ResourceType. Skip Cleanup: " + 
job.getInstanceType());
+                return true;
+            }
+            switch (resourceType) {
+                case Volume:
+                    VolumeInfo vol = volFactory.getVolume(job.getInstanceId());
+                    if (vol == null) {
+                        s_logger.warn("Volume not found. Skip Cleanup. 
VolumeId: " + job.getInstanceId());

Review Comment:
   @kiranchavala thanks for the detailed answer



-- 
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: commits-unsubscr...@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to