|
32 | 32 |
|
33 | 33 | import org.apache.cloudstack.acl.ControlledEntity.ACLType; |
34 | 34 | import org.apache.cloudstack.acl.SecurityChecker.AccessType; |
| 35 | +import org.apache.cloudstack.api.ApiConstants; |
35 | 36 | import org.apache.cloudstack.api.response.AcquirePodIpCmdResponse; |
36 | 37 | import org.apache.cloudstack.context.CallContext; |
37 | 38 | import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService; |
@@ -850,10 +851,16 @@ public IPAddressVO doInTransaction(TransactionStatus status) throws Insufficient |
850 | 851 | errorMessage.append(", network id=" + guestNetworkId); |
851 | 852 | } |
852 | 853 | sc.setJoinParameters("vlan", "type", vlanUse); |
853 | | - |
| 854 | + String routerIpAddress = null; |
| 855 | + if (network != null) { |
| 856 | + NetworkDetailVO routerIpDetail = _networkDetailsDao.findDetail(network.getId(), ApiConstants.ROUTER_IP); |
| 857 | + routerIpAddress = routerIpDetail != null ? routerIpDetail.getValue() : null; |
| 858 | + } |
854 | 859 | if (requestedIp != null) { |
855 | 860 | sc.addAnd("address", SearchCriteria.Op.EQ, requestedIp); |
856 | 861 | errorMessage.append(": requested ip " + requestedIp + " is not available"); |
| 862 | + } else if (routerIpAddress != null) { |
| 863 | + sc.addAnd("address", Op.NEQ, routerIpAddress); |
857 | 864 | } |
858 | 865 |
|
859 | 866 | boolean ascOrder = ! forSystemVms; |
@@ -2104,7 +2111,6 @@ public void allocateDirectIp(final NicProfile nic, final DataCenter dc, final Vi |
2104 | 2111 | public void doInTransactionWithoutResult(TransactionStatus status) throws InsufficientAddressCapacityException { |
2105 | 2112 | //This method allocates direct ip for the Shared network in Advance zones |
2106 | 2113 | boolean ipv4 = false; |
2107 | | - |
2108 | 2114 | if (network.getGateway() != null) { |
2109 | 2115 | if (nic.getIPv4Address() == null) { |
2110 | 2116 | PublicIp ip = null; |
|
0 commit comments