cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [cloudstack] kioie commented on a change in pull request #3522: New API endpoint: UpdateVlanIpRange
Date Fri, 09 Aug 2019 21:01:53 GMT
kioie commented on a change in pull request #3522: New API endpoint: UpdateVlanIpRange
URL: https://github.com/apache/cloudstack/pull/3522#discussion_r312646913
 
 

 ##########
 File path: server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java
 ##########
 @@ -3958,6 +3961,116 @@ public VlanVO doInTransaction(final TransactionStatus status) {
 
     }
 
+    @Override
+    public Vlan updateVlanAndPublicIpRange(UpdateVlanIpRangeCmd cmd) throws ConcurrentOperationException,
+            ResourceUnavailableException, ResourceAllocationException{
+
+        return  updateVlanAndPublicIpRange(cmd.getId(), cmd.getStartIp(),cmd.getEndIp(),
+                cmd.getGateway(),cmd.getNetmask());
+    }
+
+    @DB
+    @ActionEvent(eventType = EventTypes.EVENT_VLAN_IP_RANGE_UPDATE, eventDescription = "update
vlan ip Range", async
+            = false)
+    public Vlan updateVlanAndPublicIpRange(final long id, String startIp,
+                                           String endIp,
+                                           String gateway,
+                                           String netmask) throws ConcurrentOperationException{
+
+        // verify parameters
+        VlanVO vlanRange = _vlanDao.findById(id);
+        if (vlanRange == null) {
+            throw new InvalidParameterValueException("Please specify a valid IP range id.");
+        }
+
+        if (gateway == null) {
+            gateway = vlanRange.getVlanGateway();
+        }
+
+        if (netmask == null) {
+            netmask = vlanRange.getVlanNetmask();
+        }
+
+        final String[] existingVlanIPRangeArray = vlanRange.getIpRange().split("-");
+        final String currentStartIP= existingVlanIPRangeArray[0];
+        final String currentEndIP = existingVlanIPRangeArray [1];
+
+        if(startIp == null){
+            startIp= currentStartIP;
+        }
+
+        if(endIp == null){
+            endIp= currentEndIP;
+        }
+
+        // Check if the VLAN has any allocated public IPs
+        final List<IPAddressVO> ips = _publicIpAddressDao.listByVlanId(id);
+        for (final IPAddressVO ip : ips) {
+            if (ip.getState()== IpAddress.State.Allocated){
 
 Review comment:
   Thought its okay, because it ensures the boundaries remain within range. Regarding the
info that could be withheld? what did you have in mind?

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message