sureshanaparti commented on code in PR #11249:
URL: https://github.com/apache/cloudstack/pull/11249#discussion_r2217899326


##########
server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java:
##########
@@ -6071,6 +6094,30 @@ public boolean deleteVlanIpRange(final 
DeleteVlanIpRangeCmd cmd) {
     private boolean deleteAndPublishVlanAndPublicIpRange(final long userId, 
final long vlanDbId, final Account caller) {
         VlanVO deletedVlan = deleteVlanAndPublicIpRange(userId, vlanDbId, 
caller);
         if (deletedVlan != null) {
+            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) {
+                String networkCidr = networkVO.getCidr();
+                String cidrToRemove = 
NetUtils.getCidrFromGatewayAndNetmask(deletedVlan.getVlanGateway(), 
deletedVlan.getVlanNetmask());
+                String newNetworkCidr = 
com.cloud.utils.StringUtils.updateCommaSeparatedStringWithValue(networkCidr, 
cidrToRemove, false);
+                networkVO.setCidr(newNetworkCidr);
+
+                String networkGateway = networkVO.getGateway();
+                String newNetworkGateway = 
com.cloud.utils.StringUtils.updateCommaSeparatedStringWithValue(networkGateway, 
deletedVlan.getVlanGateway(), false);
+                networkVO.setGateway(newNetworkGateway);
+            } else if (ipv6) {
+                String networkIp6Cidr = networkVO.getIp6Cidr();
+                String newNetworkIp6Cidr = 
com.cloud.utils.StringUtils.updateCommaSeparatedStringWithValue(networkIp6Cidr, 
deletedVlan.getIp6Cidr(), false);
+                networkVO.setCidr(newNetworkIp6Cidr);

Review Comment:
   ```suggestion
                   networkVO.setIp6Cidr(newNetworkIp6Cidr);
   ```



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

To unsubscribe, e-mail: commits-unsubscr...@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to