Fixes to handle 404 exceptions when export policy and ontap volume ar… - #73
Fixes to handle 404 exceptions when export policy and ontap volume ar…#73sandeeplocharla wants to merge 4 commits into
Conversation
|
This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch. |
f94975a to
5aab5f7
Compare
There was a problem hiding this comment.
Pull request overview
This PR improves resilience of the ONTAP storagepool delete workflow by treating ONTAP “404 Not Found” responses as a no-op when attempting to delete already-missing export policies and volumes, reducing avoidable failures/noise during cleanup.
Changes:
- Handle
FeignExceptionwith HTTP 404 for export policy deletion (NAS) as a no-op. - Handle
FeignExceptionwith HTTP 404 for volume deletion as a no-op. - Minor import reordering/cleanup in the touched classes.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/service/UnifiedNASStrategy.java | Treats 404 during export policy deletion as a no-op to avoid failing storagepool deletion when the policy is already missing. |
| plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/service/StorageStrategy.java | Treats 404 during volume deletion as a no-op to avoid failing cleanup when the volume is already missing. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
5aab5f7 to
c5ec5b2
Compare
|
This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch. |
c5ec5b2 to
ca63c9c
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.
Suppressed comments (2)
plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/service/UnifiedNASStrategy.java:192
- The inner FeignException handler throws a CloudRuntimeException, but the outer
catch (Exception e)immediately catches and wraps it again. This results in double-logging/double-wrapping and can obscure the original message/cause chain. Prefer letting CloudRuntimeException propagate from the outer block.
logger.error("deleteAccessGroup: Failed to delete export policy. Exception: {}", e.getMessage(), e);
throw new CloudRuntimeException("Failed to delete export policy: " + e.getMessage(), e);
plugins/storage/volume/ontap/src/test/java/org/apache/cloudstack/storage/service/StorageStrategyTest.java:984
- The new test method is indented inconsistently relative to the rest of the class (extra leading spaces on
@Test, the method, and its body). This hurts readability and may fail style checks if test sources are formatted/checked.
@Test
void testDeleteFlexVolSnapshotForCloudStackVolume_Feign404_TreatedAsSuccess() {
FeignException notFoundException = mock(FeignException.class);
when(notFoundException.status()).thenReturn(404);
when(snapshotFeignClient.deleteSnapshot(anyString(), eq("fv-uuid-1"), eq("snap-uuid-1")))
Fixes to handle 404 exceptions when export policy and ontap volume are missing during storagepool delete workflow
Description
This PR...
Has fixes to handle 404 Not found exceptions in case of 'ExportPolicy' and 'Volume' deletion.
Screenshots (if appropriate):
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
How Has This Been Tested?
How did you try to break this feature and the system with this change?