4.23.0.0: restartVPC cleanup=true with public IPs on two VLANs fails with UnsupportedOperationException and leaves the VPC without a backup router

未關閉 適合新手
#14,430 4 則留言 0 個 reaction 已指派 1 人 在 GitHub 檢視

維護者通常 1 天內回覆

@bernardodemarco 已經在處理了。

開始於 2026年10月28日。

評估

難度
2/5
預估耗時
1-3 小時
新手友好度
78/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
java

研究方向

閱讀第 761 行附近的 NetworkHelperImpl.java,接著沿著 publicConfig 的值追蹤到第 165 行附近的 VpcNetworkHelperImpl.reallocateRouterNetworks。重現兩個 VLAN 的設定和 restartVPC cleanup=true,或新增一個針對可變清單行為的回歸測試。當路由器網路重新分配能接受兩個 VLAN,且滾動重新啟動在有備援路由器的情況下完成時,即表示完成。

由索引模型根據 Issue 內容生成。

描述

bug
problem

NetworkHelperImpl.java line 761 (4.23.0.0 and main) is:

publicConfig.put(publicNetworks.get(0), List.of(defaultNic));

List.of returns an immutable list. VpcNetworkHelperImpl.reallocateRouterNetworks (line 165) then calls addAll on it and throws UnsupportedOperationException (ImmutableCollections.addAll), through NetworkHelperImpl.deployRouterWithTemplates (line 542) and VpcManagerImpl.rollingRestartVpc (line 4046). 4.22.0.0 used new ArrayList(Arrays.asList(defaultNic)).

The API answers "Internal Server Error". The rolling restart has already destroyed the backup router, and the new router stays Stopped.

Related: #12621 (fixed by #12622 in 4.22) has the same setup but a different error ("cidr is not formatted correctly"). This one is a separate bug.

versions

CloudStack 4.23.0.0 and main. 4.22.0.0 is not affected. KVM.

The steps to reproduce the bug
  1. A zone with public IP ranges on two VLANs.
  2. A redundant VPC with its source NAT IP on the first VLAN.
  3. Acquire a second public IP from the second VLAN and enable static NAT on it to a VM in the VPC. (A bare IP with no NAT or rule does not reach this code path; see VpcManagerImpl.isIpAllocatedToVpc.)
  4. restartVPC cleanup=true.
What to do about it?

Use a mutable list again, for example:

publicConfig.put(publicNetworks.get(0), new ArrayList<>(List.of(defaultNic)));

We carry this one-line change. With it, the new routers get NICs on both VLANs and the restart succeeds.

主要語言
Java
星號
3.1k
分支
1.4k
平均合併
10 天 9 小時
30 天內合併 PR
20

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

apache/cloudstack 的其他 Issue

查看 apache/cloudstack 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。