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 摘要。