Skip to content

Fix listPublicIpAddresses NPE on shared networks with a VR - #14249

Open
MitchDrage wants to merge 1 commit into
apache:4.22from
MitchDrage:listpublicip-placeholder-npe
Open

MitchDrage wants to merge 1 commit into
apache:4.22from
MitchDrage:listpublicip-placeholder-npe

Conversation

@MitchDrage

Copy link
Copy Markdown

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)
  • 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
  • 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 branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant