cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yvsubhash <...@git.apache.org>
Subject [GitHub] cloudstack pull request #1908: CLOUDSTACK-9317: Fixed disable static nat on ...
Date Wed, 18 Jan 2017 09:58:23 GMT
Github user yvsubhash commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/1908#discussion_r96598944
  
    --- Diff: server/src/com/cloud/network/router/CommandSetupHelper.java ---
    @@ -823,13 +826,39 @@ 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 ( _firewallsDao.countRulesByIpIdAndState(ip.getId(), FirewallRule.State.Active)
> 0 ) {
    +                    ipsWithrules++;
    +                }
    +
    +                if (ip.isOneToOneNat()) {
    +                    ipsStaticNat++;
    +                }
    +            }
    +
                 final IpAssocCommand cmd = new IpAssocCommand(ipsToSend);
                 cmd.setAccessDetail(NetworkElementCommand.ROUTER_IP, _routerControlHelper.getRouterControlIp(router.getId()));
                 cmd.setAccessDetail(NetworkElementCommand.ROUTER_GUEST_IP, _routerControlHelper.getRouterIpInNetwork(associatedWithNetworkId,
router.getId()));
                 cmd.setAccessDetail(NetworkElementCommand.ROUTER_NAME, router.getInstanceName());
                 final DataCenterVO dcVo = _dcDao.findById(router.getDataCenterId());
                 cmd.setAccessDetail(NetworkElementCommand.ZONE_NETWORK_TYPE, dcVo.getNetworkType().toString());
     
    +            boolean remove = false;
    +            // if there is only one static nat then it will be checked for remove at
the resource
    +            if (ipsWithrules == 0 && (ipsStaticNat == 0 || ipsStaticNat == 1))
{
    --- End diff --
    
    Can you combine these two if blocks and eliminate remove variable if this is not getting
used at a later place


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