nvazquez commented on code in PR #8906:
URL: https://github.com/apache/cloudstack/pull/8906#discussion_r1731909803


##########
server/src/main/java/com/cloud/network/vpc/VpcManagerImpl.java:
##########
@@ -3161,17 +3170,21 @@ protected List<IPAddressVO> 
listPublicIpsAssignedToVpc(final long accountId, fin
     }
 
     @Override
-    public PublicIp assignSourceNatIpAddressToVpc(final Account owner, final 
Vpc vpc) throws InsufficientAddressCapacityException, 
ConcurrentOperationException {
+    public PublicIp assignSourceNatIpAddressToVpc(final Account owner, final 
Vpc vpc, final Long podId, final boolean forNsx) throws 
InsufficientAddressCapacityException, ConcurrentOperationException {
         final long dcId = vpc.getZoneId();
 
-        final IPAddressVO sourceNatIp = 
getExistingSourceNatInVpc(owner.getId(), vpc.getId());
+        final IPAddressVO sourceNatIp = 
getExistingSourceNatInVpc(owner.getId(), vpc.getId(), forNsx);
 
         PublicIp ipToReturn = null;
 
         if (sourceNatIp != null) {
             ipToReturn = PublicIp.createFromAddrAndVlan(sourceNatIp, 
_vlanDao.findById(sourceNatIp.getVlanId()));
         } else {
-            ipToReturn = _ipAddrMgr.assignDedicateIpAddress(owner, null, 
vpc.getId(), dcId, true);
+            if (!forNsx) {
+                ipToReturn = _ipAddrMgr.assignDedicateIpAddress(owner, null, 
vpc.getId(), dcId, true);
+            } else {
+                ipToReturn = _ipAddrMgr.assignPublicIpAddress(dcId, podId, 
owner, Vlan.VlanType.VirtualNetwork, null, null, false, true);
+            }

Review Comment:
   @DaanHoogland no problem I'll refactor it, but why isn't it optimal?



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to