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 #1908: CLOUDSTACK-9317: Fixed disable static nat on ...
Date Mon, 20 Mar 2017 09:21:58 GMT
Github user ProjectMoon commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/1908#discussion_r106857110
  
    --- Diff: server/src/com/cloud/network/router/CommandSetupHelper.java ---
    @@ -848,13 +849,37 @@ public int compare(final PublicIpAddress o1, final PublicIpAddress
o2) {
                     associatedWithNetworkId = ipAddrList.get(0).getNetworkId();
                 }
     
    +            // for network if the ips does not have any rules, then only last ip
    +            List<IPAddressVO> userIps = _ipAddressDao.listByAssociatedNetwork(associatedWithNetworkId,
null);
    +
    +            int ipsWithrules = 0;
    +            int ipsStaticNat = 0;
    +            for (IPAddressVO ip : userIps) {
    +                if ( _rulesDao.countRulesByIpIdAndState(ip.getId(), FirewallRule.State.Active)
> 0 ) {
    +                    ipsWithrules++;
    +                }
    +
    +                // check onetoonenat and also check if the ip "add":false. If there are
2 PF remove 1 static nat add
    +                if (ip.isOneToOneNat() && ip.getRuleState() == null) {
    --- End diff --
    
    Similar to the comments about checking if `lastIp` isn't null, I find that checking rule
state to be null is a bit ... obscure. What is null supposed to mean in this context? It seems
the `rule_state` column is only changed to `Releasing` when releasing an IP and nothing else.
I guess that's intentional?


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