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

Đang mở Phù hợp với người mới
#14,430 4 bình luận 0 reaction 1 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@bernardodemarco đang làm issue này rồi.

Từ ngày 28/10/2026.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
78/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
java
Lĩnh vực
infrastructure

Hướng nghiên cứu

Đọc NetworkHelperImpl.java quanh dòng 761, sau đó lần theo giá trị publicConfig đến VpcNetworkHelperImpl.reallocateRouterNetworks quanh dòng 165. Tái hiện cấu hình hai VLAN và restartVPC cleanup=true, hoặc thêm một bài kiểm thử hồi quy tập trung vào hành vi của danh sách có thể thay đổi. Công việc hoàn tất khi việc phân bổ lại mạng của router chấp nhận cả hai VLAN và quá trình khởi động lại luân phiên kết thúc với một router dự phòng.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
Java
Star
3.1k
Fork
1.4k
Merge trung bình
9 ngày 12 giờ
Pull request đã merge (30 ngày)
22

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của apache/cloudstack

Tất cả issue của apache/cloudstack

Issue tương tự

Thêm issue về Java

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.