feat(ipv6): add IPv6 address family detection and nvme-cli IPv6 fixes#276
Conversation
There was a problem hiding this comment.
Pull request overview
This PR improves NVMe/TCP IPv6 support across the SPDK client and nvme-cli initiator integration, adding address-family auto-detection and safer parsing/normalization for IPv6 inputs.
Changes:
- Exported
DetectAddressFamily()inpkg/spdk/clientand used it to select IPv4 vs IPv6 when adding NVMe-oF listeners / setting ANA state. - Added
normalizeNvmeAddr()to strip IPv6 brackets before passing addresses tonvme-cli -a, and added unit tests. - Updated
GetIPAndPortFromControllerAddress()parsing to usestrings.SplitNand added IPv6-oriented unit tests.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| pkg/spdk/client/advanced.go | Adds exported address-family detection and uses it for listener creation and ANA state setting. |
| pkg/spdk/client/advanced_test.go | Adds unit tests for DetectAddressFamily(). |
| pkg/initiator/nvmecli.go | Normalizes bracketed IPv6 for nvme-cli usage and improves controller address parsing. |
| pkg/initiator/nvmecli_test.go | Adds unit tests for IPv6 normalization and controller address parsing. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Export DetectAddressFamily() in pkg/spdk/client for adrfam auto-detection - Replace hardcoded NvmeAddressFamilyIPv4 in StartExposeBdev/StartExposeBdevWithANAState - Add normalizeNvmeAddr() in pkg/initiator to strip brackets from IPv6 for nvme-cli -a - Use SplitN in GetIPAndPortFromControllerAddress to correctly split IPv6 traddr values Address review comments (PR longhorn#276): - DetectAddressFamily: strip brackets before net.ParseIP so [fd00::1] is handled correctly - normalizeNvmeAddr: downgrade log from Warn to Debug (bracketed IPv6 is normal input) - GetIPAndPortFromControllerAddress: add IPv6 example to function comment Signed-off-by: Raphanus Lo <yunchang.lo@suse.com>
d167ac4 to
ad3285f
Compare
- Export DetectAddressFamily() in pkg/spdk/client for adrfam auto-detection - Replace hardcoded NvmeAddressFamilyIPv4 in StartExposeBdev/StartExposeBdevWithANAState - Add NormalizeNvmeAddr() in pkg/util to strip brackets from IPv6 addresses - Use NormalizeNvmeAddr in DetectAddressFamily and nvme-cli call sites - Use SplitN in GetIPAndPortFromControllerAddress to correctly split IPv6 traddr values Address review comments (PR longhorn#276): - DetectAddressFamily: delegate bracket stripping to util.NormalizeNvmeAddr - normalizeNvmeAddr: extracted to pkg/util as NormalizeNvmeAddr (shared across packages) - normalizeNvmeAddr: downgrade log from Warn to Debug; removed now it is in util - GetIPAndPortFromControllerAddress: add IPv6 example to function comment Signed-off-by: Raphanus Lo <yunchang.lo@suse.com>
e9c921e to
e426ec6
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
e426ec6 to
ecdf1c3
Compare
derekbit
left a comment
There was a problem hiding this comment.
In general, LGTM. The comments are more for coding style.
|
After resolving comments, we can merge the PR. |
Signed-off-by: Raphanus Lo <yunchang.lo@suse.com>
ecdf1c3 to
cf51c16
Compare
Which issue(s) this PR fixes:
DetectAddressFamily()in pkg/spdk/client for adrfam auto-detectionNvmeAddressFamilyIPv4inNvmfSubsystemAddListenerandStartExposeBdevWithANAStatewith dynamic detection viaDetectAddressFamily()normalizeNvmeAddr()to strip brackets fornvme-cli -aflagstrings.Split->strings.SplitNinGetIPAndPortFromControllerAddressto handle IPv6 addresses containing colonsIssue longhorn/longhorn#10928
What this PR does / why we need it:
Special notes for your reviewer:
Additional documentation or context