cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rafaelweingartner <...@git.apache.org>
Subject [GitHub] cloudstack pull request: CLOUDSTACK-9317: Enable/disable static NA...
Date Thu, 24 Mar 2016 13:10:28 GMT
Github user rafaelweingartner commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/1450#discussion_r57313534
  
    --- 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()));
    +        }
    +
    +        return userIps;
    +    }
    +
         @Override
         public boolean applyStaticNats(List<? extends StaticNat> staticNats, boolean
continueOnError, boolean forRevoke) throws ResourceUnavailableException {
             if (staticNats == null || staticNats.size() == 0) {
    --- End diff --
    
    I know this is not your code; but, what about changing "staticNats == null || staticNats.size()
== 0" to "CollectionUtils.isEmpty(staticNats)"


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