DaanHoogland commented on a change in pull request #5373:
URL: https://github.com/apache/cloudstack/pull/5373#discussion_r697304106



##########
File path: server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java
##########
@@ -1411,7 +1411,15 @@ protected void 
expungeVolumesInPrimaryStorageIfNeeded(VolumeVO volume) throws In
         if (volOnPrimary != null) {
             s_logger.info("Expunging volume " + volume.getId() + " from 
primary data store");
             AsyncCallFuture<VolumeApiResult> future = 
volService.expungeVolumeAsync(volOnPrimary);
-            future.get();
+            VolumeApiResult result = future.get();
+            if (result.isFailed()) {
+                s_logger.warn("Failed to expunge the volume " + volume + " in 
primary storage");
+                String details = "";
+                if (result.getResult() != null && 
!result.getResult().isEmpty()) {
+                    details = result.getResult();
+                }
+                throw new CloudRuntimeException(details);
+            }

Review comment:
       except for the word "primary" vs "secondary" this block is exactly the 
same as the one below. can we unify it in a method and call it twice?




-- 
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