ravening commented on a change in pull request #4010:
URL: https://github.com/apache/cloudstack/pull/4010#discussion_r521255335



##########
File path: 
server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java
##########
@@ -1463,6 +1464,175 @@ public void doInTransactionWithoutResult(final 
TransactionStatus status) {
         }
     }
 
+    @Override
+    @DB
+    public void updatePodIpRange(final UpdatePodManagementNetworkIpRangeCmd 
cmd) throws ConcurrentOperationException {
+        final long podId = cmd.getPodId();
+        final String currentStartIP = cmd.getCurrentStartIP();
+        final String currentEndIP = cmd.getCurrentEndIP();
+        final HostPodVO pod = _podDao.findById(podId);
+
+        String newStartIP = cmd.getNewStartIP();
+        String newEndIP = cmd.getNewEndIP();
+
+        if (newStartIP == null) {
+            newStartIP = currentStartIP;
+        }
+
+        if (newEndIP == null) {
+            newEndIP = currentEndIP;
+        }
+
+        if (pod == null) {
+            throw new InvalidParameterValueException("Unable to find pod by id 
" + podId);
+        }
+
+        final String[] existingPodIpRanges = pod.getDescription().split(",");
+        if (existingPodIpRanges.length == 0) {
+            throw new InvalidParameterValueException("The IP range cannot be 
found since the existing IP range is empty.");
+        }
+
+        verifyIpRangeParameters(currentStartIP,currentEndIP);
+        verifyIpRangeParameters(newStartIP,newEndIP);
+        
checkIpRangeContainsTakenAddresses(pod,currentStartIP,currentEndIP,newStartIP,newEndIP);
+
+        String vlan = 
verifyPodIpRangeExists(podId,existingPodIpRanges,currentStartIP,currentEndIP,newStartIP,newEndIP);
+
+        List<Long> currentIpRange = 
listAllIPsWithintheRange(currentStartIP,currentEndIP);

Review comment:
       Same case here also. if `newStartIP` and `newEndIP` are same current 
ones then you are creating two arrays with same contents




----------------------------------------------------------------
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]


Reply via email to