You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by "DaanHoogland (via GitHub)" <gi...@apache.org> on 2023/01/31 15:36:27 UTC

[GitHub] [cloudstack] DaanHoogland commented on a diff in pull request #7150: Global ACL for VPCs

DaanHoogland commented on code in PR #7150:
URL: https://github.com/apache/cloudstack/pull/7150#discussion_r1092096891


##########
server/src/main/java/com/cloud/network/vpc/NetworkACLServiceImpl.java:
##########
@@ -103,12 +104,15 @@ public class NetworkACLServiceImpl extends ManagerBase implements NetworkACLServ
 
     @Override
     public NetworkACL createNetworkACL(final String name, final String description, final long vpcId, final Boolean forDisplay) {
-        final Account caller = CallContext.current().getCallingAccount();
-        final Vpc vpc = _entityMgr.findById(Vpc.class, vpcId);
-        if (vpc == null) {
-            throw new InvalidParameterValueException("Unable to find VPC");
+        if (vpcId != 0) {
+            final Account caller = CallContext.current().getCallingAccount();
+            final Vpc vpc = _vpcDao.findById(vpcId);

Review Comment:
   why does this need to change from `_entityMgr.findById(Vpc.class, vpcId)` to `_vpcDao.findById(vpcId)`? I a sure someone implemented this on purpose at some point.



##########
server/src/main/java/com/cloud/network/vpc/NetworkACLServiceImpl.java:
##########
@@ -1138,17 +1133,59 @@ protected void validateMoveAclRulesData(NetworkACLItemVO ruleBeingMoved, Network
         if (nextRule == null && previousRule == null) {
             throw new InvalidParameterValueException("Both previous and next ACL rule IDs cannot be invalid.");
         }
-        long aclId = ruleBeingMoved.getAclId();
+        long ruleAclId = ruleBeingMoved.getAclId();

Review Comment:
   why must this be renamed? The new name does seem clearer to me.



##########
api/src/main/java/org/apache/cloudstack/api/command/user/network/CreateNetworkACLListCmd.java:
##########
@@ -111,12 +120,23 @@ public void execute() throws ResourceUnavailableException {
 
     @Override
     public long getEntityOwnerId() {
-        Vpc vpc = _entityMgr.findById(Vpc.class, getVpcId());
-        if (vpc == null) {
-            throw new InvalidParameterValueException("Invalid vpcId is given");
-        }
+        Account account;
+        Long vpcId = getVpcId();

Review Comment:
   why not just use `vpcId`?



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