Hiding system reserved IP addresses (#4408)

This PR removes system reserved IP addresses from the options of acquiring IP addresses. Choosing any reserved IP address results in an error. The IP addresses should not have been displayed in the first place.

Fixes: #4310
This commit is contained in:
Spaceman1984 2020-11-02 10:40:16 +02:00 committed by GitHub
parent 3ab43e2edb
commit 18e837516a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1998,6 +1998,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
sb.and("vpcId", sb.entity().getVpcId(), SearchCriteria.Op.EQ);
sb.and("state", sb.entity().getState(), SearchCriteria.Op.EQ);
sb.and("display", sb.entity().isDisplay(), SearchCriteria.Op.EQ);
sb.and("forsystemvms", sb.entity().isForSystemVms(), SearchCriteria.Op.EQ);
if (forLoadBalancing != null && forLoadBalancing) {
final SearchBuilder<LoadBalancerVO> lbSearch = _loadbalancerDao.createSearchBuilder();
@ -2106,6 +2107,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
sc.setParameters("state", state);
}
sc.setParameters( "forsystemvms", false);
final Pair<List<IPAddressVO>, Integer> result = _publicIpAddressDao.searchAndCount(sc, searchFilter);
return new Pair<List<? extends IpAddress>, Integer>(result.first(), result.second());
}