-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/9254/#review16105
-----------------------------------------------------------
Wei, thanks for the patch. But can you prevent addition of a boolean flag like
`updated`? The method needs clean up to ensure that the finally {} block
doesn't run business logic based on a boolean flag `result` set within the try
{} block. I'd move that logic in to the try{} block itself in that case. Also
the various paramater checks like :
a) whether the vm exists in the network
b) if the network is available to be static-natted across
should go before the try block is entered. Or when they throw an exception we
perform the finally {//business logic} that doesn't need to be done.
Do you see this simplifying the method?
- Prasanna Santhanam
On Feb. 1, 2013, 2:36 p.m., Wei ZHOU wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/9254/
> -----------------------------------------------------------
>
> (Updated Feb. 1, 2013, 2:36 p.m.)
>
>
> Review request for cloudstack, Prasanna Santhanam, Jessica Wang, and Alena
> Prokharchyk.
>
>
> Description
> -------
>
> The issue occur in two conditions
> (1) If I use two sessions or browsers to EnableStaticNat on CloudStack UI.
> one is successful, the other is failed. However, there is no ip in database.
> (2) If I use API call EnableStaticNat several times The first time succeed,
> the second failed, the third succeed. the result is
> success-fail-success-fail-success-fail, which it is not correct.
>
> This is because the improperly use of result boolean flag in
> com.cloud.network.rules.RulesManagerImpl.enableStaticNat(long, long, long,
> boolean), the table user_ip_address(one_to_one_nat , vm_id) will set to
> (0,null) when the operation failed.
>
> For this issue, I add a new flag "updated" to describe whether the table
> user_ip_address in database has been changed..
>
>
> This addresses bug CLOUDSTACK-1088.
>
>
> Diffs
> -----
>
> server/src/com/cloud/network/rules/RulesManagerImpl.java 2383366
>
> Diff: https://reviews.apache.org/r/9254/diff/
>
>
> Testing
> -------
>
> Test in following operations
> (1) assign a ip to a vm several times.
> (2) assign two ip to a vm
> (3) assign a ip to two vms
> It works well.
>
>
> Thanks,
>
> Wei ZHOU
>
>