fix: filter ports by network_id for floating IP attachment#7
Draft
Koan-Bot wants to merge 2 commits into
Draft
Conversation
Demonstrates the bug where add_floating_ip_to_server() blindly picks the first port instead of filtering by network_id. On multi-homed VMs with multiple NICs, this attaches the floating IP to the wrong port. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
On multi-homed VMs with multiple NICs, the old code blindly picked the first port returned by the API, which could attach the floating IP to the wrong network interface. Now accepts an optional network_id param to filter ports, and create_vm passes the VM's network_id to ensure correct port selection. Backward compatible — omitting network_id preserves the old first-port behavior. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Koan-Bot
force-pushed
the
koan.atoomic/fix-floating-ip-port-filter
branch
from
April 20, 2026 13:22
ababae8 to
481cd71
Compare
7 tasks
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.
What
add_floating_ip_to_server()now filters ports bynetwork_idinstead of blindly picking the first port.Why
On multi-homed VMs (multiple NICs on different networks), the old code grabbed
ports->[0]— whichever port the API returned first. This could attach the floating IP to the wrong interface (e.g. a management NIC instead of the production one). The original code even had a comment acknowledging this:# pick the first port for now (maybe need to check the network_id...).How
network_idparameter toadd_floating_ip_to_server()via%optshashcreate_vm()now passes$network->{id}(the VM's internal network) to ensure correct port selectionnetwork_idpreserves backward-compatible first-port behaviorTesting
t/floating-ip-port-filter.twith 3 scenarios:🤖 Generated with Claude Code
Quality Report
Changes: 4 files changed, 191 insertions(+), 6 deletions(-)
Code scan: clean
Tests: passed (OK)
Branch hygiene: clean
Generated by Kōan post-mission quality pipeline