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