Open
Conversation
bnaecker
reviewed
Feb 20, 2026
| let missing_v6 = wants_v6 && nic.ipv6.is_none(); | ||
| if missing_v4 || missing_v6 { | ||
| Err(TransactionError::CustomError( | ||
| network_interface::InsertError::NoAvailableIpAddresses { |
Collaborator
There was a problem hiding this comment.
Could we add the IP version to this error variant, and include it in the external error we emit? It'd be nice to know which as a client.
bnaecker
approved these changes
Feb 20, 2026
Collaborator
bnaecker
left a comment
There was a problem hiding this comment.
Looks good, thanks. One suggestion, but otherwise fire when ready
This patch fixes a subtle and rare bug in instance creation. If the user requests an instance with a v4-only nic or a v6-only nic and there isn't an available address in the subnet, the request will fail due to a sql constraint requiring at least one of ip and ipv6 to be not null. However, if the user requests a dual-stack nic and one address type (but not the other) is exhausted, the sql constraint is satisfied, and the request succeeds. But the created nic won't have both requested address types. This patch adds a check after the query runs to ensure that all requested address types were created, and fail if they weren't.
7cf1f73 to
93bf8c4
Compare
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.
This patch fixes a subtle and rare bug in instance creation. If the user requests an instance with a v4-only nic or a v6-only nic and there isn't an available address in the subet, the request will fail due to a sql constraint requiring at least one of ip and ipv6 to be not null. However, if the user requests a dual-stack nic and one address type (but not the other) is exhausted, the sql constraint is satisfied, and the request succeeds. But the created nic won't have both requested address types.
This patch adds a check after the query runs to ensure that all requested address types were created, and fail if they weren't.
Note: this is a nit-picky follow-up to #9880. This bug would be pretty hard to tickle in real life, but I wanted to submit the fix for completeness.