You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by "BryanMLima (via GitHub)" <gi...@apache.org> on 2023/05/19 17:51:41 UTC

[GitHub] [cloudstack] BryanMLima commented on a diff in pull request #7378: Public IP quarantine feature

BryanMLima commented on code in PR #7378:
URL: https://github.com/apache/cloudstack/pull/7378#discussion_r1199225722


##########
server/src/main/java/com/cloud/network/IpAddressManagerImpl.java:
##########
@@ -971,6 +988,13 @@ public List<IPAddressVO> doInTransaction(TransactionStatus status) throws Insuff
 
                 if (lockOneRow) {
                     assert (addrs.size() == 1) : "Return size is incorrect: " + addrs.size();
+                    IpAddress ipAddress = addrs.get(0);
+                    boolean ipCanBeAllocated = checkIfPublicIpAddressIsNotInQuarantineAndCanBeAllocated(ipAddress, owner);
+
+                    if (!ipCanBeAllocated) {
+                        throw new InsufficientAddressCapacityException(String.format("Failed to allocate public IP address [%s] as it is in quarantine.", ipAddress.getAddress()),
+                                DataCenter.class, dcId);
+                    }

Review Comment:
   Hey @DaanHoogland, most of the time I would agree with this, even though the method would only be called once, there are scenarios that would improve code legibility. However,  in this case, I think the code is already clear.



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org