DaanHoogland commented on a change in pull request #3522: New API endpoint:
UpdateVlanIpRange
URL: https://github.com/apache/cloudstack/pull/3522#discussion_r315156668
##########
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:
I don't think it is very user friendly to keep complaining on single Ip
addresses one by one if there are say 20. Not saying anything of course is
worse, so not sure if we should block this PR for it. I see you closed the
issue, should I continue this discussion somewhere else?
----------------------------------------------------------------
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