You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2021/08/27 09:45:04 UTC

[GitHub] [cloudstack] DaanHoogland commented on a change in pull request #5373: server: do not remove volume from DB if fail to expunge it from primary storage or secondary storage

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

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