kioie commented on issue #2797: updatePod does not update start/end IPs
URL: https://github.com/apache/cloudstack/issues/2797#issuecomment-485661498
 
 
   Is there a situation where a pod can have multiple IPs as shown below?
   ```
   // Check if start IP and end IP of all the ranges lie in the CIDR subnet.
           final String[] existingPodIpRanges = pod.getDescription().split(",");
   
           for(String podIpRange: existingPodIpRanges) {
               final String[] existingPodIpRange = podIpRange.split("-");
   
               if (existingPodIpRange.length > 1) {
                   if (!NetUtils.isValidIp4(existingPodIpRange[0]) || 
!NetUtils.isValidIp4(existingPodIpRange[1])) {
                       continue;
                   }
   
                   if (!NetUtils.getCidrSubNet(existingPodIpRange[0], 
cidrSize).equalsIgnoreCase(NetUtils.getCidrSubNet(cidrAddress, cidrSize))) {
                       throw new InvalidParameterValueException("The start 
address of the some IP range is not in the CIDR subnet.");
                   }
   
                   if (!NetUtils.getCidrSubNet(existingPodIpRange[1], 
cidrSize).equalsIgnoreCase(NetUtils.getCidrSubNet(cidrAddress, cidrSize))) {
                       throw new InvalidParameterValueException("The end 
address of the some IP range is not in the CIDR subnet.");
                   }
   
                   if (NetUtils.ipRangesOverlap(existingPodIpRange[0], 
existingPodIpRange[1], gateway, gateway)) {
                       throw new InvalidParameterValueException("The gateway 
shouldn't overlap some start/end ip addresses");
                   }
               }
           }
   ```
   Also, I'm curious as to why the pod start and end IP details are stored as a 
string in the description field? cc @DaanHoogland @rhtyd 
   
   ![Screen Shot 2019-04-23 at 9 29 57 
AM](https://user-images.githubusercontent.com/20902920/56559489-77302380-65aa-11e9-8a8a-f9c8cb7b5bf2.png)
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to