mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Issue #: 5954
Status 5954: resolved fixed exclude link local gateway
This commit is contained in:
parent
41f7c745bd
commit
3106c2ae3f
@ -52,6 +52,7 @@ public class DataCenterLinkLocalIpAddressDaoImpl extends GenericDaoBase<DataCent
|
|||||||
SearchCriteria<DataCenterLinkLocalIpAddressVO> sc = FreeIpSearch.create();
|
SearchCriteria<DataCenterLinkLocalIpAddressVO> sc = FreeIpSearch.create();
|
||||||
sc.setParameters("dc", dcId);
|
sc.setParameters("dc", dcId);
|
||||||
sc.setParameters("pod", podId);
|
sc.setParameters("pod", podId);
|
||||||
|
sc.setParameters("ipAddr", NetUtils.getLinkLocalGateway()); /*explicitly removing the gateway*/
|
||||||
|
|
||||||
Transaction txn = Transaction.currentTxn();
|
Transaction txn = Transaction.currentTxn();
|
||||||
try {
|
try {
|
||||||
@ -141,6 +142,7 @@ public class DataCenterLinkLocalIpAddressDaoImpl extends GenericDaoBase<DataCent
|
|||||||
FreeIpSearch = createSearchBuilder();
|
FreeIpSearch = createSearchBuilder();
|
||||||
FreeIpSearch.and("dc", FreeIpSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
|
FreeIpSearch.and("dc", FreeIpSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
|
||||||
FreeIpSearch.and("pod", FreeIpSearch.entity().getPodId(), SearchCriteria.Op.EQ);
|
FreeIpSearch.and("pod", FreeIpSearch.entity().getPodId(), SearchCriteria.Op.EQ);
|
||||||
|
FreeIpSearch.and("ipAddr", FreeIpSearch.entity().getIpAddress(), SearchCriteria.Op.NEQ);
|
||||||
FreeIpSearch.and("taken", FreeIpSearch.entity().getTakenAt(), SearchCriteria.Op.NULL);
|
FreeIpSearch.and("taken", FreeIpSearch.entity().getTakenAt(), SearchCriteria.Op.NULL);
|
||||||
FreeIpSearch.done();
|
FreeIpSearch.done();
|
||||||
|
|
||||||
|
|||||||
@ -668,7 +668,15 @@ public class NetUtils {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
/*reserve gateway*/
|
/*reserve gateway*/
|
||||||
return getIpRangeFromCidr(getLinkLocalGateway(), 32 - size);
|
String[] range = getIpRangeFromCidr(getLinkLocalGateway(), 32 - size);
|
||||||
|
|
||||||
|
if (range[0].equalsIgnoreCase(getLinkLocalGateway())) {
|
||||||
|
/*remove the gateway*/
|
||||||
|
long ip = ip2Long(range[0]);
|
||||||
|
ip += 1;
|
||||||
|
range[0] = long2Ip(ip);
|
||||||
|
}
|
||||||
|
return range;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getLinkLocalIpEnd() {
|
public static String getLinkLocalIpEnd() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user