Fix listPublicIpAddresses NPE on shared networks with a VR - #14249
Open
MitchDrage wants to merge 1 commit into
Open
MitchDrage wants to merge 1 commit into
MitchDrage wants to merge 1 commit into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 callsgetInstanceId()and throws.This switches it to the existing
findNonPlaceHolderByIp4AddressAndNetworkId(). I've also setissystemto true in the router branch again. 4.20 set it for router IPs, #10458 changed it so thatissystemended 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
Feature/Enhancement Scale or Bug Severity
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
Added a unit test to ApiResponseHelperTest.
In the simulator, with a shared network on
DefaultSharedNetworkOfferingand one VM, about half of thelistPublicIpAddresses forvirtualnetwork=falsecalls 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.