weizhouapache commented on code in PR #10081:
URL: https://github.com/apache/cloudstack/pull/10081#discussion_r1879675871


##########
server/src/main/java/com/cloud/network/vpc/VpcManagerImpl.java:
##########
@@ -3402,6 +3402,15 @@ public boolean isSrcNatIpRequired(long vpcOfferingId) {
                 && 
vpcOffSvcProvidersMap.get(Service.Gateway).contains(Network.Provider.VPCVirtualRouter));
     }
 
+    @Override
+    public boolean isSrcNatIpRequiredForVpcVr(long vpcOfferingId) {
+        final Map<Network.Service, Set<Network.Provider>> 
vpcOffSvcProvidersMap = getVpcOffSvcProvidersMap(vpcOfferingId);
+        return 
(Objects.nonNull(vpcOffSvcProvidersMap.get(Network.Service.SourceNat))
+                && 
vpcOffSvcProvidersMap.get(Network.Service.SourceNat).contains(Network.Provider.VPCVirtualRouter))
+                || 
(Objects.nonNull(vpcOffSvcProvidersMap.get(Network.Service.Gateway))
+                && 
vpcOffSvcProvidersMap.get(Service.Gateway).contains(Network.Provider.VPCVirtualRouter));
+    }

Review Comment:
   good question
   To be honest, I never tested the case that SourceNat and StaticNat are 
provided by different providers (e.g. Nsx for Source NAT and VPCVirtualRouter 
for Static NAT). I do not think it will work.
   
   this PR is aligned with the 4.19 code
   
   
https://github.com/apache/cloudstack/blob/f9b176744e6a47837f6153b550a4117e9d453a45/server/src/main/java/com/cloud/network/vpc/VpcManagerImpl.java#L3115-L3119
   
   



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