MitchDrage opened a new pull request, #14249:
URL: https://github.com/apache/cloudstack/pull/14249

   ### Description
   
   Fixes an intermittent NullPointerException in listPublicIpAddresses when a 
shared network has a VR.
   
   For shared network IPs, `showVmInfoForSharedNetworks()` looks up the NIC by 
IP and network. For the VR's IP there are two NICs, the real one and the VR's 
placeholder NIC (null instance_id), and the lookup returns one of them at 
random. When it gets the placeholder, the router branch added in #10458 calls 
`getInstanceId()` and throws.
   
   This switches it to the existing 
`findNonPlaceHolderByIp4AddressAndNetworkId()`. I've also set `issystem` to 
true in the router branch again. 4.20 set it for router IPs, #10458 changed it 
so that `issystem` ended up as false so I've switched it back to true. With it 
set to false, the UI offers Release IP on the VR's address which it shouldn't 
do.
   
   4.20 isn't affected.
   
   Fixes: #14248
   
   ### Types of changes
   
   - [ ] Breaking change (fix or feature that would cause existing 
functionality to change)
   - [ ] New feature (non-breaking change which adds functionality)
   - [x] Bug fix (non-breaking change which fixes an issue)
   - [ ] Enhancement (improves an existing feature and functionality)
   - [ ] Cleanup (Code refactoring and cleanup, that may add test cases)
   - [ ] Build/CI
   - [ ] Test (unit or integration test code)
   
   ### Feature/Enhancement Scale or Bug Severity
   
   #### Bug Severity
   
   - [ ] BLOCKER
   - [ ] Critical
   - [ ] Major
   - [x] Minor
   - [ ] Trivial
   
   ### Screenshots (if appropriate):
   
   ### How Has This Been Tested?
   
   Added a unit test to ApiResponseHelperTest.
   
   In the simulator, with a shared network on `DefaultSharedNetworkOffering` 
and one VM, about half of the `listPublicIpAddresses forvirtualnetwork=false` 
calls failed before the change. After it, none did, and the VR's IP shows the 
router with issystem=true.
   
   We were hitting this on 4.22.1.0 in production too.
   
   
   #### How did you try to break this feature and the system with this change?
   
   Tried releasing the VR's IP afterwards. It's still refused, as it should be.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to