bhouse-nexthop opened a new issue, #14631: URL: https://github.com/apache/cloudstack/issues/14631
### problem A `restartNetwork` that fails with a `ResourceUnavailableException` is reported as an unexpected error, while the same failure from `restartVPC` is not. `RestartNetworkCmd.execute()` doesn't catch the checked exceptions that `NetworkService.restartNetwork()` declares, so they reach `ApiAsyncJobDispatcher`. The dispatcher logs anything that isn't a `ServerApiException` at ERROR as `Unexpected exception while executing ... RestartNetworkCmd`, with a stack trace, and fails the job with error code 530. `RestartVPCCmd.execute()` catches the same exceptions and maps them to `ServerApiException`: `ResourceUnavailableException` gives 534 at WARN, `ConcurrentOperationException` 530 and `InsufficientCapacityException` 533. API clients therefore see a different error code for the same condition depending on whether the network is in a VPC, and the management server log shows an ERROR for an expected refusal. ### versions 4.22 (the code is the same on main). ### The steps to reproduce the bug 1. Make a network restart fail with a `ResourceUnavailableException`. For example, stop the CloudStack agent on the host that runs the network's router, so that the commands to the router fail with `AgentUnavailableException`, and call `restartNetwork` on that network. 2. The async job fails with error code 530, and the management server logs `Unexpected exception while executing org.apache.cloudstack.api.command.user.network.RestartNetworkCmd` at ERROR. 3. Do the same with `restartVPC` on a VPC: the job fails with 534, and the exception is logged at WARN. ### What to do about it? Catch the exceptions in `RestartNetworkCmd.execute()` the way `RestartVPCCmd.execute()` does. -- 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]
