diff --git a/seaweed-block/cmd/blockvolume/main.go b/seaweed-block/cmd/blockvolume/main.go index 58492c62d8..41c76ef20e 100644 --- a/seaweed-block/cmd/blockvolume/main.go +++ b/seaweed-block/cmd/blockvolume/main.go @@ -878,6 +878,7 @@ func run(f flags) int { probeProvider = &durableProbeProvider{provider: durableProv} } nvmeTarget = nvme.NewTarget(nvme.TargetConfig{ + Transport: nvme.Transport(f.nvmeTransport), Listen: f.nvmeListen, SubsysNQN: f.nvmeSubsysNQN, VolumeID: f.volumeID, diff --git a/seaweed-block/core/frontend/nvme/target.go b/seaweed-block/core/frontend/nvme/target.go index 085fb8ffdb..c0ed3355cc 100644 --- a/seaweed-block/core/frontend/nvme/target.go +++ b/seaweed-block/core/frontend/nvme/target.go @@ -1,6 +1,6 @@ package nvme -// NVMe/TCP target — TCP listener + accept loop. +// NVMe-oF target — listener + accept loop. // // Symmetric with core/frontend/iscsi/target.go: one Target per // volume, opens a frontend.Backend per session via the supplied @@ -23,9 +23,13 @@ type ProbeBackendProvider interface { ProbeBackend(ctx context.Context, volumeID string) (frontend.Backend, error) } -// TargetConfig configures an NVMe/TCP Target. +// TargetConfig configures an NVMe-oF Target. type TargetConfig struct { - // Listen TCP address (":0" for tests). + // Transport selects the NVMe-oF listener. Empty means TCP. RDMA is a + // reserved seam and currently returns ErrTransportUnsupported. + Transport Transport + + // Listen address (":0" for tests). Listen string // SubsysNQN is the subsystem NVMe Qualified Name advertised @@ -58,9 +62,13 @@ type TargetConfig struct { // Logger (nil → log.Default). Logger *log.Logger + + // ListenerFactory is test/future-transport injection. Nil uses the built-in + // TCP listener and explicit RDMA unsupported boundary. + ListenerFactory ListenerFactory } -// Target is a TCP-listening NVMe/TCP target. +// Target is an NVMe-oF target. type Target struct { cfg TargetConfig @@ -144,9 +152,14 @@ func (t *Target) Start() (string, error) { if t.ln != nil { return "", fmt.Errorf("nvme: Target already started") } - ln, err := net.Listen("tcp", t.cfg.Listen) + listen := defaultListenerFactory + if t.cfg.ListenerFactory != nil { + listen = t.cfg.ListenerFactory + } + transport := normalizeTransport(t.cfg.Transport) + ln, err := listen(transport, t.cfg.Listen) if err != nil { - return "", fmt.Errorf("nvme: listen %q: %w", t.cfg.Listen, err) + return "", fmt.Errorf("nvme: listen transport=%s addr=%q: %w", transport, t.cfg.Listen, err) } t.ln = ln go t.acceptLoop(ln) diff --git a/seaweed-block/core/frontend/nvme/transport.go b/seaweed-block/core/frontend/nvme/transport.go new file mode 100644 index 0000000000..495227fef3 --- /dev/null +++ b/seaweed-block/core/frontend/nvme/transport.go @@ -0,0 +1,44 @@ +package nvme + +import ( + "errors" + "fmt" + "net" +) + +// Transport names the NVMe-oF transport used by Target. +type Transport string + +const ( + // TransportTCP is the currently implemented NVMe-oF data path. + TransportTCP Transport = "tcp" + // TransportRDMA is reserved for the future NVMe/RDMA listener. + TransportRDMA Transport = "rdma" +) + +// ErrTransportUnsupported is returned when the target is asked to bind a +// transport whose listener is not implemented. +var ErrTransportUnsupported = errors.New("nvme: transport unsupported") + +// ListenerFactory is the narrow seam a future RDMA listener must satisfy. It is +// intentionally net.Listener-shaped because the NVMe session layer already +// consumes net.Conn. +type ListenerFactory func(transport Transport, listen string) (net.Listener, error) + +func defaultListenerFactory(transport Transport, listen string) (net.Listener, error) { + switch normalizeTransport(transport) { + case TransportTCP: + return net.Listen("tcp", listen) + case TransportRDMA: + return nil, fmt.Errorf("%w: %s listener not implemented", ErrTransportUnsupported, TransportRDMA) + default: + return nil, fmt.Errorf("%w: %s", ErrTransportUnsupported, transport) + } +} + +func normalizeTransport(transport Transport) Transport { + if transport == "" { + return TransportTCP + } + return transport +} diff --git a/seaweed-block/core/frontend/nvme/transport_test.go b/seaweed-block/core/frontend/nvme/transport_test.go new file mode 100644 index 0000000000..8dffed2edf --- /dev/null +++ b/seaweed-block/core/frontend/nvme/transport_test.go @@ -0,0 +1,72 @@ +package nvme_test + +import ( + "errors" + "net" + "testing" + + "github.com/seaweedfs/seaweed-block/core/frontend" + "github.com/seaweedfs/seaweed-block/core/frontend/nvme" + "github.com/seaweedfs/seaweed-block/core/frontend/testback" +) + +func TestTargetTransport_DefaultsToTCP(t *testing.T) { + tg := nvme.NewTarget(nvme.TargetConfig{ + Listen: "127.0.0.1:0", + SubsysNQN: "nqn.2026-07.example.phase118:subsys", + VolumeID: "v1", + Provider: testback.NewStaticProvider(testback.NewRecordingBackend(frontend.Identity{ + VolumeID: "v1", ReplicaID: "r1", Epoch: 1, EndpointVersion: 1, + })), + }) + addr, err := tg.Start() + if err != nil { + t.Fatalf("Target.Start: %v", err) + } + if addr == "" { + t.Fatal("Target.Start returned empty address") + } + t.Cleanup(func() { _ = tg.Close() }) +} + +func TestTargetTransport_RDMAIsExplicitlyUnsupported(t *testing.T) { + tg := nvme.NewTarget(nvme.TargetConfig{ + Transport: nvme.TransportRDMA, + Listen: "127.0.0.1:0", + SubsysNQN: "nqn.2026-07.example.phase118:subsys", + VolumeID: "v1", + Provider: testback.NewStaticProvider(testback.NewRecordingBackend(frontend.Identity{ + VolumeID: "v1", ReplicaID: "r1", Epoch: 1, EndpointVersion: 1, + })), + }) + _, err := tg.Start() + if !errors.Is(err, nvme.ErrTransportUnsupported) { + t.Fatalf("Target.Start error=%v, want ErrTransportUnsupported", err) + } +} + +func TestTargetTransport_ListenerFactoryReceivesSelectedTransport(t *testing.T) { + var gotTransport nvme.Transport + var gotListen string + tg := nvme.NewTarget(nvme.TargetConfig{ + Transport: nvme.TransportRDMA, + Listen: "rdma://mlx5_0:4420", + SubsysNQN: "nqn.2026-07.example.phase118:subsys", + VolumeID: "v1", + Provider: testback.NewStaticProvider(testback.NewRecordingBackend(frontend.Identity{ + VolumeID: "v1", ReplicaID: "r1", Epoch: 1, EndpointVersion: 1, + })), + ListenerFactory: func(transport nvme.Transport, listen string) (net.Listener, error) { + gotTransport = transport + gotListen = listen + return nil, nvme.ErrTransportUnsupported + }, + }) + _, err := tg.Start() + if !errors.Is(err, nvme.ErrTransportUnsupported) { + t.Fatalf("Target.Start error=%v, want ErrTransportUnsupported", err) + } + if gotTransport != nvme.TransportRDMA || gotListen != "rdma://mlx5_0:4420" { + t.Fatalf("factory got transport=%q listen=%q", gotTransport, gotListen) + } +} diff --git a/seaweed-block/docs/roadmap.md b/seaweed-block/docs/roadmap.md index 3b72e4ef18..6e39235d47 100644 --- a/seaweed-block/docs/roadmap.md +++ b/seaweed-block/docs/roadmap.md @@ -609,6 +609,14 @@ Recommended order from here: not available, this phase blocks as artifact-readiness, not as product failure. Do not mark the NVMe/TCP path as a published-image release claim until this smoke passes. +76. Phase 118: NVMe/RDMA Transport Seam. **Active** + Start the RoCE/NVMe-RDMA implementation track without making a false RoCE + claim. The NVMe target now has an explicit transport selector and listener + seam: TCP remains the default implemented path, RDMA returns a typed + unsupported error at the target layer, and `blockvolume + --nvme-transport=rdma` still refuses publicly until a real RDMA listener + lands. The next step is a minimal RDMA listener or a concrete lab-backed + blocker from the RDMA integration work. The internal release-train contract is `internal/docs/ref/operation-layer-v0.5-release-train.md`. Phases 41-44 close diff --git a/seaweed-block/internal/docs/current-plan.md b/seaweed-block/internal/docs/current-plan.md index eb8868ffba..db2e563478 100644 --- a/seaweed-block/internal/docs/current-plan.md +++ b/seaweed-block/internal/docs/current-plan.md @@ -1,84 +1,86 @@ -# Current Plan: Phase 117 NVMe/TCP Published-Image Release Smoke +# Current Plan: Phase 118 NVMe/RDMA Transport Seam -Status: gate implemented; waiting for matching published images. +Status: D1 implemented locally; QA gate pending. -Phase 116 is closed: +Phase 117 remains ready but artifact-blocked until matching published images +exist: ```text -Result: docs PASS -Docs: - README.md - docs/user-capabilities.md - docs/releases/README.md - docs/releases/nvme-tcp-supported-lab.md +SW_BLOCK_RELEASE_IMAGE=ghcr.io/seaweedfs/seaweed-block:sha- +SW_BLOCK_CSI_RELEASE_IMAGE=ghcr.io/seaweedfs/seaweed-block-csi:sha- ``` ## Why This Is Next -Phases 100-115 are source-gated and live-lab validated. Phase 116 packaged the -claim boundary for users. The remaining release gap is artifact verification: -the documented NVMe/TCP path must be proven on matching published -`seaweed-block` and `seaweed-block-csi` images before it becomes a -published-image claim. +Phases 100-115 proved the NVMe/TCP supported-lab path. Phase 116 packaged the +claim, and Phase 117 prepared the published-image smoke. The next product +expansion is NVMe/RDMA/RoCE, but the current target is hardwired to TCP and +Phase 104 intentionally rejects `--nvme-transport=rdma`. + +The first useful implementation step is not a fake RoCE claim. It is a narrow +target transport seam that: + +- preserves the TCP data path unchanged; +- gives the target an explicit transport selector; +- returns a typed unsupported error for RDMA; +- keeps the public blockvolume CLI refusal until a real RDMA listener exists. ## Product Goal -Validate that the published image pair contains the same NVMe/TCP behavior that -passed in source-gated lab runs: +Move from "RDMA is only a command-line refusal" to "the NVMe target has a real +transport boundary where an RDMA listener can be inserted and tested." -- generated Helm values select `protocol=nvme`; -- chart render enables external NVMe/TCP and stage-2 multipath; -- one RF=2 NVMe/TCP PVC mounts into an app pod; -- writer/reader I/O passes; -- `SwBlockVolume.status.nvme.pathCount=2`; -- status is `Ready=True/first_volume_verified`; -- cleanup verifier returns zero residue. +This lets the next phase focus on the hard part: mapping an RDMA-capable +listener into the existing NVMe session model without bypassing authority, +readiness, ANA, cleanup, or status. -## Inputs Required +## Deliverables -Exact matching image tags or digests: +Implemented: ```text -ghcr.io/seaweedfs/seaweed-block: -ghcr.io/seaweedfs/seaweed-block-csi: +core/frontend/nvme/transport.go +core/frontend/nvme/transport_test.go +scripts/run-phase118-nvme-rdma-transport-seam-gate.sh +testops/scenarios/nvme-rdma-transport-seam-chain.yaml +internal/docs/qa-assignments/phase118-nvme-rdma-transport-seam-qa-signoff.md ``` -Both images must be built from the same source commit. If either image is -missing, mark this phase artifact-blocked, not product-failed. - -## Gate - -Use a small release-smoke gate rather than rerunning every Phase 100-115 gate: +Changed: ```text -scripts/run-phase117-nvme-release-image-smoke-gate.sh -testops/scenarios/nvme-tcp-release-image-smoke-chain.yaml +core/frontend/nvme/target.go +cmd/blockvolume/main.go ``` -If `SW_BLOCK_RELEASE_IMAGE` / `SW_BLOCK_CSI_RELEASE_IMAGE` are not supplied, or -if either manifest is missing, the gate writes -`phase117_nvme_release_image_smoke_status=blocked_missing_release_images`. That -is an artifact-readiness blocker, not a product failure. +## Gate Evidence -Minimum terminal evidence: +Required terminal evidence: ```text -phase117_nvme_release_image_smoke_status=ok -image_pair_commit_match=true -helm_values_protocol=nvme -stage2_multipath_enabled=true -writer_verified=true -reader_verified=true -volume_status=ready -volume_reason=first_volume_verified -nvme_path_count=2 -cleanup_status=ok -failure_count=0 +phase118_nvme_rdma_transport_seam_status=ok +go_test_nvme_blockvolume=ok +target_transport_seam_present=true +rdma_target_error_typed=true +blockvolume_rdma_public_refusal=true +rdma_listener_implemented=false +roce_claim_allowed=false ``` +## Next After D1 + +Phase 119 should choose one concrete RDMA implementation path: + +- implement a minimal RDMA listener that can satisfy the target listener seam; +- or prove, with code and lab evidence, which dependency blocks that listener + (`libibverbs`, `rdma-core`, kernel ULP, SPDK/NVMe target reuse, or cgo + packaging). + +Do not add Kubernetes/Helm RoCE flags until a local target listener can accept a +real RDMA connection or emits a precise implementation blocker. + ## Non-Claims -Phase 117 does not add RoCE/NVMe-RDMA, performance/SLO, broad host -compatibility, production HA, node-loss survival, backup/restore, or unbounded -path churn claims. It only verifies that the published image pair can run the -representative supported-lab NVMe/TCP path. +Phase 118 does not claim NVMe/RDMA attach, RoCE I/O, performance/SLO, broad +host compatibility, production HA, node-loss survival, backup/restore, or +published-image support. diff --git a/seaweed-block/internal/docs/product-roadmap.md b/seaweed-block/internal/docs/product-roadmap.md index 9edda827d5..154be6d504 100644 --- a/seaweed-block/internal/docs/product-roadmap.md +++ b/seaweed-block/internal/docs/product-roadmap.md @@ -321,7 +321,12 @@ rebuild, delete safety, or cleanup must start as a separate gated phase. - Phase 117 has a pinned-image smoke gate and TestOps scenario ready. It should run when matching images exist. If images are not published, the result is artifact-blocked rather than a product failure. -- Later protocol candidates: implement a real NVMe/RDMA target or characterize +- Phase 118 starts the NVMe/RDMA/RoCE implementation track with a transport + seam inside `core/frontend/nvme.Target`. TCP remains the only implemented + public path; RDMA is now a typed target-layer unsupported transport rather + than just a CLI string rejection. The next protocol step is a minimal RDMA + listener or a concrete lab-backed blocker from the RDMA integration work. +- Later protocol candidates: complete a real NVMe/RDMA target or characterize NVMe/TCP performance. Keep these separate so correctness, transport, and performance claims do not get mixed. diff --git a/seaweed-block/internal/docs/qa-assignments/phase118-nvme-rdma-transport-seam-qa-signoff.md b/seaweed-block/internal/docs/qa-assignments/phase118-nvme-rdma-transport-seam-qa-signoff.md new file mode 100644 index 0000000000..450fbedf4d --- /dev/null +++ b/seaweed-block/internal/docs/qa-assignments/phase118-nvme-rdma-transport-seam-qa-signoff.md @@ -0,0 +1,47 @@ +# Phase 118 NVMe/RDMA Transport Seam QA + +Status: pending QA. + +## Scope + +Phase 118 starts the NVMe/RDMA/RoCE implementation track without making a false +RoCE claim. The deliverable is the first code seam inside the NVMe target: + +- `core/frontend/nvme.Target` now has a transport selector; +- empty transport remains TCP and preserves existing behavior; +- RDMA returns a typed unsupported error at the target layer; +- `cmd/blockvolume --nvme-transport=rdma` still refuses publicly, so users + cannot accidentally claim RoCE support before a real listener exists. + +This phase is not a live RoCE I/O proof. + +## Gate + +```bash +bash scripts/run-phase118-nvme-rdma-transport-seam-gate.sh "$PWD" +``` + +or: + +```powershell +C:\work\swblock.exe run testops/scenarios/nvme-rdma-transport-seam-chain.yaml +``` + +## Required Evidence + +```text +phase118_nvme_rdma_transport_seam_status=ok +go_test_nvme_blockvolume=ok +target_transport_seam_present=true +rdma_target_error_typed=true +blockvolume_rdma_public_refusal=true +rdma_listener_implemented=false +roce_claim_allowed=false +``` + +## Non-Claims + +Phase 118 does not claim NVMe/RDMA attach, RoCE I/O, performance, production +HA, or published-image support. The next implementation step must either add a +real RDMA listener or produce a concrete blocker from the RDMA library/kernel +integration work. diff --git a/seaweed-block/scripts/run-phase118-nvme-rdma-transport-seam-gate.sh b/seaweed-block/scripts/run-phase118-nvme-rdma-transport-seam-gate.sh new file mode 100755 index 0000000000..0ed67eba89 --- /dev/null +++ b/seaweed-block/scripts/run-phase118-nvme-rdma-transport-seam-gate.sh @@ -0,0 +1,50 @@ +#!/usr/bin/env bash +set -euo pipefail + +ROOT="${1:-$(pwd)}" +ARTIFACT_DIR="${SW_BLOCK_ARTIFACT_DIR:-${ROOT}/results/phase118-nvme-rdma-transport-seam-gate}" +SUMMARY="${ARTIFACT_DIR}/phase118-nvme-rdma-transport-seam-summary.txt" + +mkdir -p "${ARTIFACT_DIR}"/{go,cli} +: >"${SUMMARY}" + +write_summary() { + echo "$*" | tee -a "${SUMMARY}" >/dev/null +} + +write_summary "phase118_nvme_rdma_transport_seam_status=running" + +cd "${ROOT}" + +go test ./core/frontend/nvme ./cmd/blockvolume \ + >"${ARTIFACT_DIR}/go/test.stdout.txt" 2>"${ARTIFACT_DIR}/go/test.stderr.txt" +write_summary "go_test_nvme_blockvolume=ok" + +if go run ./cmd/blockvolume \ + --master 127.0.0.1:1 \ + --server-id phase118-rdma-refusal \ + --volume-id phase118-v1 \ + --replica-id r1 \ + --data-addr 127.0.0.1:0 \ + --ctrl-addr 127.0.0.1:0 \ + --nvme-listen 127.0.0.1:0 \ + --nvme-subsysnqn nqn.2026-07.io.seaweedfs.phase118:rdma-refusal \ + --nvme-transport rdma \ + >"${ARTIFACT_DIR}/cli/blockvolume-rdma.stdout.txt" \ + 2>"${ARTIFACT_DIR}/cli/blockvolume-rdma.stderr.txt"; then + write_summary "blockvolume_rdma_public_refusal=false" + write_summary "phase118_nvme_rdma_transport_seam_status=failed" + exit 1 +fi + +grep -q -- '--nvme-transport="rdma" unsupported; only "tcp" is implemented' \ + "${ARTIFACT_DIR}/cli/blockvolume-rdma.stderr.txt" + +write_summary "target_transport_seam_present=true" +write_summary "rdma_target_error_typed=true" +write_summary "blockvolume_rdma_public_refusal=true" +write_summary "rdma_listener_implemented=false" +write_summary "roce_claim_allowed=false" +write_summary "phase118_nvme_rdma_transport_seam_status=ok" + +echo "[phase118] PASS" diff --git a/seaweed-block/testops/scenarios/nvme-rdma-transport-seam-chain.yaml b/seaweed-block/testops/scenarios/nvme-rdma-transport-seam-chain.yaml new file mode 100644 index 0000000000..dbefa818f3 --- /dev/null +++ b/seaweed-block/testops/scenarios/nvme-rdma-transport-seam-chain.yaml @@ -0,0 +1,79 @@ +name: nvme-rdma-transport-seam-chain +timeout: 20m + +env: + product_root: "/tmp/seaweed_block" + ssh_key: "C:\\work\\dev_server\\testdev_key" + +topology: + nodes: + m02: + host: 192.168.1.184 + user: testdev + key: "{{ ssh_key }}" + +phases: + - name: run_phase118_gate + actions: + - action: exec + node: m02 + timeout: 15m + cmd: "cd {{ product_root }} && bash scripts/run-phase118-nvme-rdma-transport-seam-gate.sh {{ product_root }}" + env.SW_BLOCK_ARTIFACT_DIR: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase118-nvme-rdma-transport-seam/gate" + - action: grep_log + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase118-nvme-rdma-transport-seam/gate/phase118-nvme-rdma-transport-seam-summary.txt" + pattern: "^phase118_nvme_rdma_transport_seam_status=ok$" + save_as: gate_ok + - action: assert_greater + actual: "{{ gate_ok }}" + threshold: "0" + - action: grep_log + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase118-nvme-rdma-transport-seam/gate/phase118-nvme-rdma-transport-seam-summary.txt" + pattern: "^target_transport_seam_present=true$" + save_as: seam_present + - action: assert_greater + actual: "{{ seam_present }}" + threshold: "0" + - action: grep_log + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase118-nvme-rdma-transport-seam/gate/phase118-nvme-rdma-transport-seam-summary.txt" + pattern: "^rdma_target_error_typed=true$" + save_as: typed_error + - action: assert_greater + actual: "{{ typed_error }}" + threshold: "0" + - action: grep_log + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase118-nvme-rdma-transport-seam/gate/phase118-nvme-rdma-transport-seam-summary.txt" + pattern: "^blockvolume_rdma_public_refusal=true$" + save_as: public_refusal + - action: assert_greater + actual: "{{ public_refusal }}" + threshold: "0" + - action: grep_log + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase118-nvme-rdma-transport-seam/gate/phase118-nvme-rdma-transport-seam-summary.txt" + pattern: "^rdma_listener_implemented=false$" + save_as: rdma_listener_not_claimed + - action: assert_greater + actual: "{{ rdma_listener_not_claimed }}" + threshold: "0" + - action: grep_log + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase118-nvme-rdma-transport-seam/gate/phase118-nvme-rdma-transport-seam-summary.txt" + pattern: "^roce_claim_allowed=false$" + save_as: no_roce_claim + - action: assert_greater + actual: "{{ no_roce_claim }}" + threshold: "0" + + - name: collect + always: true + actions: + - action: collect_path + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase118-nvme-rdma-transport-seam" + name: "remote-phases" + ignore_error: true