Skip to content

Commit c9e7a8b

Browse files
jeanjean
authored andcommitted
Fix root cause: skip CIDR/gateway updates for Public traffic type networks
addCidrAndGatewayForIpv4/Ipv6 (introduced by PR #11249) was called for all network types without checking if the network is Public. This caused comma-separated CIDRs to be stored on Public networks, which then triggered 'cidr is not formatted correctly' errors during VPC restart. Add TrafficType.Public guard in both the VLAN creation (addCidr) and VLAN deletion (removeCidr) paths in ConfigurationManagerImpl.
1 parent af5341f commit c9e7a8b

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5425,7 +5425,7 @@ public Vlan createVlanAndPublicIpRange(final long zoneId, final long networkId,
54255425
final VlanVO vlan = commitVlanAndIpRange(zoneId, networkId, physicalNetworkId, podId, startIP, endIP, vlanGateway, vlanNetmask, vlanId, domain, vlanOwner, vlanIp6Gateway, vlanIp6Cidr,
54265426
ipv4, zone, vlanType, ipv6Range, ipRange, forSystemVms, provider);
54275427

5428-
if (vlan != null) {
5428+
if (vlan != null && network.getTrafficType() != TrafficType.Public) {
54295429
if (ipv4) {
54305430
addCidrAndGatewayForIpv4(networkId, vlanGateway, vlanNetmask);
54315431
} else if (ipv6) {
@@ -6504,11 +6504,14 @@ private boolean deleteAndPublishVlanAndPublicIpRange(final long userId, final lo
65046504
final boolean ipv4 = deletedVlan.getVlanGateway() != null;
65056505
final boolean ipv6 = deletedVlan.getIp6Gateway() != null;
65066506
final long networkId = deletedVlan.getNetworkId();
6507+
final NetworkVO networkVO = _networkDao.findById(networkId);
65076508

6508-
if (ipv4) {
6509-
removeCidrAndGatewayForIpv4(networkId, deletedVlan);
6510-
} else if (ipv6) {
6511-
removeCidrAndGatewayForIpv6(networkId, deletedVlan);
6509+
if (networkVO != null && networkVO.getTrafficType() != TrafficType.Public) {
6510+
if (ipv4) {
6511+
removeCidrAndGatewayForIpv4(networkId, deletedVlan);
6512+
} else if (ipv6) {
6513+
removeCidrAndGatewayForIpv6(networkId, deletedVlan);
6514+
}
65126515
}
65136516

65146517
messageBus.publish(_name, MESSAGE_DELETE_VLAN_IP_RANGE_EVENT, PublishScope.LOCAL, deletedVlan);

0 commit comments

Comments
 (0)