[ 
https://issues.apache.org/jira/browse/CLOUDSTACK-9317?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15206849#comment-15206849
 ] 

ASF GitHub Bot commented on CLOUDSTACK-9317:
--------------------------------------------

Github user rafaelweingartner commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/1450#discussion_r57031859
  
    --- Diff: server/src/com/cloud/network/IpAddressManagerImpl.java ---
    @@ -1714,8 +1714,13 @@ public boolean applyStaticNats(List<? extends 
StaticNat> staticNats, boolean con
                 return true;
             }
     
    -        // get the list of public ip's owned by the network
    -        List<IPAddressVO> userIps = 
_ipAddressDao.listByAssociatedNetwork(network.getId(), null);
    +        // get the list of public ip's that need to be applied for the 
static NAT. manipulating only these
    +        // ips prevents concurrency issues when disabling static nat at 
the same time.
    +        List<IPAddressVO> userIps = new ArrayList<>();
    --- End diff --
    
    Hi @ProjectMoon, what about creating a method that returns the userIps 
list. This new method would contain lines 1719-1722. Then, you would be able to 
write a unit test and add lines 1717-1718 as its java documentation.


> Disabling static NAT on many IPs can leave wrong IPs on the router
> ------------------------------------------------------------------
>
>                 Key: CLOUDSTACK-9317
>                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-9317
>             Project: CloudStack
>          Issue Type: Bug
>      Security Level: Public(Anyone can view this level - this is the 
> default.) 
>          Components: Management Server, Virtual Router
>    Affects Versions: 4.7.0, 4.7.1, 4.7.2
>            Reporter: Jeff Hair
>
> The current behavior of enabling or disabling static NAT will call the apply 
> IP associations method in the management server. The method is not 
> thread-safe. If it's called from multiple threads, each thread will load up 
> the list of public IPs in different states (add or revoke)--correct for the 
> thread, but not correct overall. Depending on execution order on the virtual 
> router, the router can end up with public IPs assigned to it that are not 
> supposed to be on it anymore. When another account acquires the same IP, this 
> of course leads to network problems.
> The problem has been in CS since at least 4.2, and likely affects all 
> recently released versions. Affected version is set to 4.7.x because that's 
> what we verified against.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to