cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ProjectMoon <...@git.apache.org>
Subject [GitHub] cloudstack pull request #1623: CLOUDSTACK-9317: Enable/disable static NAT as...
Date Fri, 05 Aug 2016 09:19:15 GMT
Github user ProjectMoon commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/1623#discussion_r73664374
  
    --- Diff: server/src/com/cloud/network/IpAddressManagerImpl.java ---
    @@ -1698,6 +1698,22 @@ public String acquireGuestIpAddress(Network network, String requestedIp)
{
     
         Random _rand = new Random(System.currentTimeMillis());
     
    +    /**
    +     * Get the list of public IPs that need to be applied for a static NAT enable/disable
operation.
    +     * Manipulating only these ips prevents concurrency issues when disabling static
nat at the same time.
    +     * @param staticNats
    +     * @return The list of IPs that need to be applied for the static NAT to work.
    +     */
    +    public List<IPAddressVO> getStaticNatSourceIps(List<? extends StaticNat>
staticNats) {
    +        List<IPAddressVO> userIps = new ArrayList<>();
    +
    +        for (StaticNat snat : staticNats) {
    +            userIps.add(_ipAddressDao.findById(snat.getSourceIpAddressId()));
    +        }
    --- End diff --
    
    This makes sense, yes. Better to have one database query than many.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message