Skip to content

Commit 89e0a4c

Browse files
author
Marcus Sorensen
authored
PowerFlex: Handle missing volumes gracefully during delete volume (#7924)
1 parent 2cccd8f commit 89e0a4c

1 file changed

Lines changed: 14 additions & 5 deletions

File tree

plugins/storage/volume/scaleio/src/main/java/org/apache/cloudstack/storage/datastore/client/ScaleIOGatewayClientImpl.java

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -738,11 +738,20 @@ public boolean deleteVolume(final String volumeId) {
738738
try {
739739
unmapVolumeFromAllSdcs(volumeId);
740740
} catch (Exception ignored) {}
741-
Boolean removeVolumeStatus = post(
742-
"/instances/Volume::" + volumeId + "/action/removeVolume",
743-
"{\"removeMode\":\"ONLY_ME\"}", Boolean.class);
744-
if (removeVolumeStatus != null) {
745-
return removeVolumeStatus;
741+
742+
try {
743+
Boolean removeVolumeStatus = post(
744+
"/instances/Volume::" + volumeId + "/action/removeVolume",
745+
"{\"removeMode\":\"ONLY_ME\"}", Boolean.class);
746+
if (removeVolumeStatus != null) {
747+
return removeVolumeStatus;
748+
}
749+
} catch (Exception ex) {
750+
if (ex instanceof ServerApiException && ex.getMessage().contains("Could not find the volume")) {
751+
LOG.warn(String.format("API says deleting volume %s does not exist, handling gracefully", volumeId));
752+
return true;
753+
}
754+
throw ex;
746755
}
747756
return false;
748757
}

0 commit comments

Comments
 (0)