PowerFlex: Handle missing volumes gracefully during delete volume (#7924)

This commit is contained in:
Marcus Sorensen 2023-08-31 13:43:45 -06:00 committed by GitHub
parent 2cccd8f754
commit 89e0a4ca25
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -738,11 +738,20 @@ public class ScaleIOGatewayClientImpl implements ScaleIOGatewayClient {
try {
unmapVolumeFromAllSdcs(volumeId);
} catch (Exception ignored) {}
Boolean removeVolumeStatus = post(
"/instances/Volume::" + volumeId + "/action/removeVolume",
"{\"removeMode\":\"ONLY_ME\"}", Boolean.class);
if (removeVolumeStatus != null) {
return removeVolumeStatus;
try {
Boolean removeVolumeStatus = post(
"/instances/Volume::" + volumeId + "/action/removeVolume",
"{\"removeMode\":\"ONLY_ME\"}", Boolean.class);
if (removeVolumeStatus != null) {
return removeVolumeStatus;
}
} catch (Exception ex) {
if (ex instanceof ServerApiException && ex.getMessage().contains("Could not find the volume")) {
LOG.warn(String.format("API says deleting volume %s does not exist, handling gracefully", volumeId));
return true;
}
throw ex;
}
return false;
}