Committed by
Gerrit Code Review
[ONOS-5098] Fix the IP release issue when rebooting VMs
Change-Id: I05d8228ccfdc04de12e2a5998f041bb93779923c
Showing
1 changed file
with
9 additions
and
0 deletions
| ... | @@ -225,6 +225,15 @@ public class DistributedDhcpStore implements DhcpStore { | ... | @@ -225,6 +225,15 @@ public class DistributedDhcpStore implements DhcpStore { |
| 225 | @Override | 225 | @Override |
| 226 | public Ip4Address releaseIP(HostId hostId) { | 226 | public Ip4Address releaseIP(HostId hostId) { |
| 227 | if (allocationMap.containsKey(hostId)) { | 227 | if (allocationMap.containsKey(hostId)) { |
| 228 | + // If the IP has been assigned with Option_RangeNotEnforced, | ||
| 229 | + // we do not release the IP address nor remove the host from HostService. | ||
| 230 | + // Therefore, if the IP is assigned statically, the IP needs to be released statically. | ||
| 231 | + Versioned<IpAssignment> assignmentVersioned = allocationMap.get(hostId); | ||
| 232 | + if (Versioned.valueOrNull(assignmentVersioned) != null && | ||
| 233 | + assignmentVersioned.value().assignmentStatus().equals(Option_RangeNotEnforced)) { | ||
| 234 | + return null; | ||
| 235 | + } | ||
| 236 | + | ||
| 228 | IpAssignment newAssignment = IpAssignment.builder(allocationMap.get(hostId).value()) | 237 | IpAssignment newAssignment = IpAssignment.builder(allocationMap.get(hostId).value()) |
| 229 | .assignmentStatus(IpAssignment.AssignmentStatus.Option_Expired) | 238 | .assignmentStatus(IpAssignment.AssignmentStatus.Option_Expired) |
| 230 | .build(); | 239 | .build(); | ... | ... |
-
Please register or login to post a comment