-
Notifications
You must be signed in to change notification settings - Fork 1.3k
VPC restart cleanup for Public networks with multi-CIDR data #12622
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 4.22
Are you sure you want to change the base?
Changes from all commits
a68680a
af5341f
c9e7a8b
ab3f662
1a22d35
f6d618b
ca2c325
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5428,7 +5428,7 @@ public Vlan createVlanAndPublicIpRange(final long zoneId, final long networkId, | |
| final VlanVO vlan = commitVlanAndIpRange(zoneId, networkId, physicalNetworkId, podId, startIP, endIP, vlanGateway, vlanNetmask, vlanId, domain, vlanOwner, vlanIp6Gateway, vlanIp6Cidr, | ||
| ipv4, zone, vlanType, ipv6Range, ipRange, forSystemVms, provider); | ||
|
|
||
| if (vlan != null) { | ||
| if (vlan != null && network.getTrafficType() != TrafficType.Public) { | ||
| if (ipv4) { | ||
| addCidrAndGatewayForIpv4(networkId, vlanGateway, vlanNetmask); | ||
| } else if (ipv6) { | ||
|
|
@@ -6507,11 +6507,14 @@ private boolean deleteAndPublishVlanAndPublicIpRange(final long userId, final lo | |
| final boolean ipv4 = deletedVlan.getVlanGateway() != null; | ||
| final boolean ipv6 = deletedVlan.getIp6Gateway() != null; | ||
| final long networkId = deletedVlan.getNetworkId(); | ||
| final NetworkVO networkVO = _networkDao.findById(networkId); | ||
|
|
||
| if (ipv4) { | ||
| removeCidrAndGatewayForIpv4(networkId, deletedVlan); | ||
| } else if (ipv6) { | ||
| removeCidrAndGatewayForIpv6(networkId, deletedVlan); | ||
| if (networkVO != null && networkVO.getTrafficType() != TrafficType.Public) { | ||
| if (ipv4) { | ||
| removeCidrAndGatewayForIpv4(networkId, deletedVlan); | ||
|
Comment on lines
+6510
to
+6514
|
||
| } else if (ipv6) { | ||
| removeCidrAndGatewayForIpv6(networkId, deletedVlan); | ||
| } | ||
| } | ||
|
|
||
| messageBus.publish(_name, MESSAGE_DELETE_VLAN_IP_RANGE_EVENT, PublishScope.LOCAL, deletedVlan); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This migration nulls
cidr/gateway(andbroadcast_uri) for alltraffic_type='Public'networks. With the currentNetworkVO.equals()implementation, two Public networks withcidr == nullcompare as equal, whileNetworkVO.hashCode()is based onid; this violates the equals/hashCode contract and can break HashSet/Map behavior (and may become more likely after this UPDATE makescidrnull everywhere). Consider either (a) updatingNetworkVO.equals()/hashCode()to be consistent (and to handle comma-separated CIDRs as described in the PR), or (b) narrowing this UPDATE to only sanitize rows that actually contain legacy comma-separated values so you don’t increase the number ofcidr == nullPublic networks.