bhouse-nexthop opened a new pull request, #14632:
URL: https://github.com/apache/cloudstack/pull/14632

   ### Description
   
   This PR makes `restartNetwork` report a failed restart the way `restartVPC` 
does.
   
   `RestartNetworkCmd.execute()` let `ResourceUnavailableException`, 
`ConcurrentOperationException` and `InsufficientCapacityException` reach the 
async job dispatcher. The dispatcher logs those at ERROR as `Unexpected 
exception while executing ... RestartNetworkCmd` and fails the job with 530. 
`RestartVPCCmd` catches them and throws a `ServerApiException` instead.
   
   `RestartNetworkCmd.execute()` now catches them in the same way, with the 
same logging:
   - `ResourceUnavailableException`: error code 534 
(`RESOURCE_UNAVAILABLE_ERROR`), logged at WARN;
   - `ConcurrentOperationException`: 530 (`INTERNAL_ERROR`), logged at WARN;
   - `InsufficientCapacityException`: 533 (`INSUFFICIENT_CAPACITY_ERROR`).
   
   The error text is the exception message in each case, as before. A restart 
that returns `false` still fails with 530 and `Failed to restart network`.
   
   Fixes: #14631
   
   ### Types of changes
   
   - [ ] Breaking change (fix or feature that would cause existing 
functionality to change)
   - [ ] New feature (non-breaking change which adds functionality)
   - [x] Bug fix (non-breaking change which fixes an issue)
   - [ ] Enhancement (improves an existing feature and functionality)
   - [ ] Cleanup (Code refactoring and cleanup, that may add test cases)
   - [ ] Build/CI
   - [x] Test (unit or integration test code)
   
   ### Feature/Enhancement Scale or Bug Severity
   
   #### Bug Severity
   
   - [ ] BLOCKER
   - [ ] Critical
   - [ ] Major
   - [x] Minor
   - [ ] Trivial
   
   ### How Has This Been Tested?
   
   - New `RestartNetworkCmdTest` (`mvn -pl api -am test 
-Dtest=RestartNetworkCmdTest`), 5 tests, all pass: success response; `false` 
from the service gives 530; each of the three exceptions gives the error code 
listed above with the exception message.
   - Found in a lab test of another change: a refused `restartNetwork` failed 
with 530 and an ERROR stack trace, while the matching `restartVPC` failed with 
534 and a WARN line. This change has not been run in that lab; the behaviour is 
covered by the unit tests.
   
   #### How did you try to break this feature and the system with this change?
   
   Checked that nothing else calls `RestartNetworkCmd.execute()` and relies on 
the checked exceptions it declared; the API dispatcher is the only caller.
   


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