restartNetwork reports a ResourceUnavailableException as an unexpected error (530), unlike restartVPC (534)

未关闭 适合新手
#14,631 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
78/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
java
领域
api, cloud

调研方向

阅读 RestartNetworkCmd.execute(),并将其异常处理与 RestartVPCCmd.execute()进行比较;issue 将后者指定为参考。检查 NetworkService.restartNetwork() 声明的异常,并按照报告中描述的对应错误映射进行追踪。完成标准是:对于两个重启命令,相同的故障会产生一致的 API 错误代码和预期的日志级别。

由索引模型根据 Issue 内容生成。

描述

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.

主要语言
Java
星标
3.1k
派生
1.4k
平均合并
6 天 20 小时
30 天内合并 PR
17

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

apache/cloudstack 的其他 Issue

查看 apache/cloudstack 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。