fix(ibm): respect configured zone for custom VPC subnets - #528
Open
Gisaldjo wants to merge 1 commit into
Open
Conversation
Select a subnet in the explicit or configured zone, creating one there if needed. Preserve first-subnet selection when no zone is provided, and creation in <region>-1 when the VPC has no subnets.
Gisaldjo
marked this pull request as ready for review
September 9, 2026 11:45
Chandan-M-N
reviewed
Sep 9, 2026
| ), | ||
| ) | ||
| if subnet is None: | ||
| raise IBMException(f"No subnet associated to vpc found: {vpc_id}") |
Contributor
There was a problem hiding this comment.
Can we also print zone in the error message, if zone is not None? It will be easier for debugging.
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.
Select a subnet in the explicit or configured zone, creating one there if needed. Preserve first-subnet selection when no zone is provided, and creation in -1 when the VPC has no subnets.
Description
Custom VPC subnet discovery currently selects the first subnet, even
when an explicit or configured zone is provided. In a multi-zone VPC,
this can select a subnet in a different zone from the requested
instance, causing instance creation to fail.
Select a subnet in the requested zone instead, creating one there if
none exists.
Preserve existing behavior when no zone is provided: select the first
subnet, or create one in
<region>-1if the VPC has no subnets.Additional Context and Relevant Issues
New zone-specific subnets include the zone in their names to avoid
collisions with existing subnets. Very long VPC names may exceed IBM's
subnet-name limit; name truncation is not addressed here.
Test Steps
final compatibility test was added.
preserving the existing subnet.
tox: Ruff passed and all 327 unit tests passed on Python 3.8.Mypy failed in unchanged Azure code at
pycloudlib/azure/instance.py:293with abegin_create_or_updateoverload mismatch.