Skip to content

Commit 4975e0b

Browse files
committed
remove or operator from quarantined addresses query
1 parent 707c02b commit 4975e0b

File tree

3 files changed

+3
-6
lines changed

3 files changed

+3
-6
lines changed

engine/schema/src/main/java/com/cloud/network/dao/PublicIpQuarantineDao.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ public interface PublicIpQuarantineDao extends GenericDao<PublicIpQuarantineVO,
3131
/**
3232
* Returns a list of public IP addresses that are actively quarantined at the specified date and the previous owner differs from the specified user.
3333
*
34-
* @param userId used to check against the IP's previous owner.
34+
* @param userId used to check against the IP's previous owner;
3535
* @param date used to check if the quarantine is active;
36-
* @return a list of PublicIpQuarantineVOs
36+
* @return a list of PublicIpQuarantineVOs.
3737
*/
3838
List<PublicIpQuarantineVO> listQuarantinedIpAddressesToUser(Long userId, Date date);
3939
}

engine/schema/src/main/java/com/cloud/network/dao/PublicIpQuarantineDaoImpl.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,6 @@ public void init() {
5656
quarantinedIpAddressesSearch.and();
5757
quarantinedIpAddressesSearch.op("removedIsNull", quarantinedIpAddressesSearch.entity().getRemoved(), SearchCriteria.Op.NULL);
5858
quarantinedIpAddressesSearch.and("endDate", quarantinedIpAddressesSearch.entity().getEndDate(), SearchCriteria.Op.GT);
59-
quarantinedIpAddressesSearch.or("removedIsNotNull", quarantinedIpAddressesSearch.entity().getRemoved(), SearchCriteria.Op.NNULL);
60-
quarantinedIpAddressesSearch.and("removedDateGt", quarantinedIpAddressesSearch.entity().getRemoved(), SearchCriteria.Op.GT);
6159
quarantinedIpAddressesSearch.cp();
6260

6361
ipAddressSearchBuilder.done();
@@ -89,7 +87,6 @@ public List<PublicIpQuarantineVO> listQuarantinedIpAddressesToUser(Long userId,
8987

9088
sc.setParameters("previousOwnerId", userId);
9189
sc.setParameters("endDate", date);
92-
sc.setParameters("removedDateGt", date);
9390

9491
return searchIncludingRemoved(sc, null, false, false);
9592
}

server/src/main/java/com/cloud/network/IpAddressManagerImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -898,7 +898,7 @@ public List<IPAddressVO> listAvailablePublicIps(final long dcId, final Long podI
898898
List<PublicIpQuarantineVO> quarantinedAddresses = publicIpQuarantineDao.listQuarantinedIpAddressesToUser(owner.getId(), new Date());
899899
List<Long> quarantinedAddressesIDs = quarantinedAddresses.stream().map(PublicIpQuarantineVO::getPublicIpAddressId).collect(Collectors.toList());
900900

901-
logger.debug("Found addresses with the following IDs: {}.", quarantinedAddressesIDs);
901+
logger.debug("Found addresses with the following IDs: [{}] that will be ignored when searching for available public IPs.", quarantinedAddressesIDs);
902902

903903
if (CollectionUtils.isNotEmpty(quarantinedAddressesIDs)) {
904904
sc.setParameters("id", quarantinedAddressesIDs.toArray());

0 commit comments

Comments
 (0)