Merge pull request #55 from seaweedfs/phase104-roce-live-io-feasibility

phase104: gate RoCE transport refusal
This commit is contained in:
Ping Qiu authored and GitHub committed 2026-06-29 00:24:42 -07:00
commit a2f58df153
9 files changed
+397 -100

No files matched your search

@@ -29,6 +29,35 @@ func TestParseFlags_IscsiPortalAddrRequiresListen(t *testing.T) {
}
}
func TestParseFlags_NVMeTransportDefaultsTCP(t *testing.T) {
args := append(requiredBlockvolumeArgs(),
"--nvme-listen", "127.0.0.1:4420",
"--nvme-subsysnqn", "nqn.2026-05.io.seaweedfs:test-v1",
)
got, err := parseFlags(args)
if err != nil {
t.Fatalf("parseFlags: %v", err)
}
if got.nvmeTransport != "tcp" {
t.Fatalf("nvmeTransport=%q want tcp", got.nvmeTransport)
}
}
func TestParseFlags_NVMeTransportRejectsRDMA(t *testing.T) {
args := append(requiredBlockvolumeArgs(),
"--nvme-listen", "127.0.0.1:4420",
"--nvme-subsysnqn", "nqn.2026-05.io.seaweedfs:test-v1",
"--nvme-transport", "rdma",
)
_, err := parseFlags(args)
if err == nil {
t.Fatal("parseFlags succeeded; want rdma transport rejected")
}
if !strings.Contains(err.Error(), `--nvme-transport="rdma" unsupported`) {
t.Fatalf("error = %q, want unsupported transport", err)
}
}
func TestParseFlags_IscsiPortalAddrDoesNotChangeLoopbackBind(t *testing.T) {
args := append(requiredBlockvolumeArgs(),
"--iscsi-listen", "127.0.0.1:3260",
+5
View File
@@ -80,6 +80,7 @@ type flags struct {
nvmeListen string
nvmeSubsysNQN string
nvmeNS uint
nvmeTransport string
// Durable-backend flags. When --durable-root is set, the iSCSI
// and NVMe providers use DurableProvider instead of memback.
@@ -151,6 +152,7 @@ func parseFlags(args []string) (flags, error) {
fs.StringVar(&f.nvmeListen, "nvme-listen", "", "NVMe/TCP target bind address (e.g. 127.0.0.1:0); empty disables. Loopback-only (no auth)")
fs.StringVar(&f.nvmeSubsysNQN, "nvme-subsysnqn", "", "NVMe subsystem NQN (required if --nvme-listen is set)")
fs.UintVar(&f.nvmeNS, "nvme-ns", 1, "NVMe namespace id (default 1)")
fs.StringVar(&f.nvmeTransport, "nvme-transport", "tcp", "NVMe-oF transport. Only \"tcp\" is implemented; \"rdma\"/RoCE is a future gated feature")
fs.StringVar(&f.durableRoot, "durable-root", "", "directory for persistent storage files; empty = memback (non-durable)")
fs.StringVar(&f.durableImpl, "durable-impl", "smartwal", "LogicalStorage impl: smartwal (default) or walstore; ignored unless --durable-root is set")
fs.UintVar(&f.durableBlocks, "durable-blocks", 2048, "number of blocks per volume on first create (ignored when opening existing)")
@@ -246,6 +248,9 @@ func parseFlags(args []string) (flags, error) {
return flags{}, fmt.Errorf("--iscsi-chap-username/--iscsi-chap-secret require --iscsi-listen")
}
if f.nvmeListen != "" {
if f.nvmeTransport != "tcp" {
return flags{}, fmt.Errorf("--nvme-transport=%q unsupported; only \"tcp\" is implemented", f.nvmeTransport)
}
if f.nvmeSubsysNQN == "" {
return flags{}, fmt.Errorf("--nvme-subsysnqn is required when --nvme-listen is set")
}
+55 -97
View File
@@ -1,136 +1,94 @@
# Current Plan: Phase 103 NVMe Multi-Host / RoCE Preflight
# Current Plan: Phase 105 Multi-Host NVMe/TCP Topology Boundary
Status: active plan.
Status: planned next.
## Why This Is Next
Phase 100 proved Kubernetes CSI NVMe/TCP multipath attach for the supported lab
path. Phase 101 hardened that path with path-loss status, repeated
stage/unstage cleanup, and bounded writer/reader soak. Phase 102 added a
release-artifact smoke gate, but that gate remains blocked until matching
published images exist.
Phase 103 proved host transport preflight. Phase 104 proved the current product
is explicitly NVMe/TCP-only and must not claim RoCE/NVMe-RDMA.
The next storage-feature question is not performance yet. It is whether the
product can tell an operator, from live host facts, what NVMe transport/topology
is actually supportable:
The next useful NVMe feature is therefore not RoCE and not performance. It is
multi-host NVMe/TCP topology correctness:
```text
NVMe/TCP multipath on current lab -> supported-lab path
RoCE / NVMe-RDMA -> explicit preflight only until hardware + live I/O gate exist
multi-host NVMe -> requires non-loopback, host-capability, and topology evidence
NVMe/TCP frontend address must be non-loopback for cross-node attach
CSI publish context must not hand a pod on node A a 127.0.0.1 target from node B
status must block unsafe topology instead of claiming Ready=True
```
Without this preflight, RoCE or multi-host NVMe claims would be another
documentation-level promise instead of a product capability.
This mirrors the earlier iSCSI loopback-cross-node blocker, but for NVMe/TCP.
## Product Goal
Add a read-only transport preflight gate that classifies the current host:
Add a topology boundary that distinguishes:
- `nvme` CLI available;
- NVMe subsystem inspection is readable;
- `nvme-fabrics`, `nvme-tcp`, and `nvme-rdma` module loaded/available state;
- RDMA device count from `/sys/class/infiniband`;
- NVMe/TCP host capability;
- RoCE preflight candidacy.
- same-node loopback NVMe/TCP attach: allowed under the supported lab path;
- cross-node loopback NVMe/TCP attach: blocked with a stable reason;
- cross-node non-loopback NVMe/TCP attach: eligible for a future live gate.
The gate must fail closed:
- missing `nvme` CLI -> blocked, not product failure;
- missing NVMe/TCP capability -> blocked, not product failure;
- no RDMA device or no `nvme-rdma` capability -> not a RoCE candidate;
- RDMA device plus `nvme-rdma` capability -> candidate only, still
`roce_claim_allowed=false` until a live RoCE I/O gate passes;
- no RoCE live I/O or performance claim may be emitted.
## D1: Gate Scaffold
Status: implemented.
Files:
The intended reason code is:
```text
scripts/run-phase103-nvme-multihost-roce-preflight-gate.sh
testops/scenarios/nvme-multihost-roce-preflight-chain.yaml
nvme_publish_target_loopback_cross_node
```
The script is intentionally read-only. It reads command availability, `/proc`,
`/sys/module`, `/lib/modules`, `/sys/class/infiniband`, and `nvme list-subsys`.
It must not run `modprobe`, `nvme connect`, `nvme disconnect`, or any
Kubernetes mutation.
or a reused protocol-neutral reason if the existing model can carry it cleanly.
## D2: Local Contract Validation
## D1: Model / Reason Contract
Required checks:
Define how ManagedVolume facts represent an NVMe publish target whose address is
loopback while the workload node differs from the blockvolume node.
Required local checks:
```text
bash -n scripts/run-phase103-nvme-multihost-roce-preflight-gate.sh
C:\work\swblock.exe validate testops/scenarios/nvme-multihost-roce-preflight-chain.yaml
go test ./scripts ./internal/testops ./core/frontend/nvme ./core/ops ./cmd/sw-block -count=1
go test ./core/ops ./cmd/sw-block -count=1
```
Success means the preflight is syntactically valid, scenario-runnable, and
covered by a read-only/claim-bounded script regression.
## D2: Report / Dashboard / Explain Agreement
## D3: Live Host Preflight
The blocked state must appear consistently in:
Run on the NVMe-capable lab node:
- summary.txt;
- operator-snapshot.json;
- dashboard `/operator-snapshot.json`;
- `ops explain`;
- CRD status if the operator-status path consumes the same evidence.
No surface may show `Ready=True` for cross-node loopback NVMe/TCP.
## D3: TestOps Scenario
Add a scenario/gate that crafts or induces:
```text
swblock run testops/scenarios/nvme-multihost-roce-preflight-chain.yaml
protocol=nvme
publish_target=127.0.0.1:<port>
blockvolume_node=m02
workload_node=m01
```
Required PASS evidence:
Expected evidence:
```text
phase103_nvme_multihost_roce_preflight_status=ok
read_only=true
nvme_cli_present=true
nvme_tcp_preflight_ready=true
roce_live_io_claim=false
performance_claim_allowed=false
status=blocked
reason=nvme_publish_target_loopback_cross_node
ready_true_count=0
safe action is observe/read_only or dry_run
```
If the lab lacks RDMA hardware, the expected result is still PASS as long as it
reports:
## D4: Live Follow-up
```text
rdma_device_count=0
roce_preflight_status=blocked_no_rdma_device
roce_preflight_candidate=false
roce_claim_allowed=false
```
If the lab has RDMA hardware and `nvme-rdma`, it may instead report:
```text
roce_preflight_status=candidate_requires_live_roce_gate
roce_preflight_candidate=true
roce_claim_allowed=false
roce_live_io_claim=false
```
That is the correct product behavior: honest candidate status, not a released
RoCE claim.
## D4: Next Decision After Preflight
Only after D3 should the team choose one of:
- RoCE live I/O gate on hardware that has RDMA devices and `nvme-rdma`;
- multi-host NVMe/TCP non-loopback topology gate;
- NVMe performance characterization.
These must stay separate because they prove different things: transport
availability, topology correctness, and performance/SLO.
If the lab can schedule a real pod on a different node while the NVMe frontend is
loopback-bound, run the live negative gate. Otherwise close D3 as replay-only
with a clear live follow-up, the same way earlier host-prereq gates handled
environment-limited cases.
## Non-Claims
Phase 103 does not claim:
Phase 105 does not claim:
- RoCE or NVMe/RDMA I/O works;
- multi-host failover works;
- performance, latency, throughput, or SLO;
- broad distro/kernel compatibility;
- production HA;
- release-image validation for NVMe.
- multi-host NVMe/TCP attach works;
- RoCE/NVMe-RDMA works;
- performance or SLO;
- production HA.
@@ -0,0 +1,92 @@
# Finished Plan: Phase 104 RoCE Live-I/O Feasibility Boundary
Status: complete. Local checks and m02 TestOps gate passed on 2026-06-29.
## Problem
Phase 103 showed that m02 is a RoCE candidate host: RDMA device present and
`nvme-rdma` available. That still does not mean Seaweed Block can serve
NVMe/RDMA. The target implementation is NVMe/TCP only.
Without an explicit refusal, release notes or chart examples could accidentally
turn "host candidate" into "product supports RoCE."
## What Changed
Added:
```text
--nvme-transport
```
to `cmd/blockvolume`:
- default `tcp`;
- only `tcp` is accepted;
- `rdma` fails clearly with:
```text
--nvme-transport="rdma" unsupported; only "tcp" is implemented
```
Added:
```text
scripts/run-phase104-roce-live-io-feasibility-gate.sh
testops/scenarios/roce-live-io-feasibility-chain.yaml
internal/docs/qa-assignments/phase104-roce-live-io-feasibility-qa-signoff.md
```
Updated:
```text
internal/docs/current-plan.md
internal/docs/product-roadmap.md
```
## Verification
Local:
```text
bash -n scripts/run-phase104-roce-live-io-feasibility-gate.sh
C:\work\swblock.exe validate testops\scenarios\roce-live-io-feasibility-chain.yaml
go test ./cmd/blockvolume ./scripts ./internal/testops ./core/frontend/nvme -count=1
git diff --check
```
Live:
```text
C:\work\swblock.exe run testops\scenarios\roce-live-io-feasibility-chain.yaml
run=20260629-002142-9c9e
result=PASS 10/10
```
Key evidence:
```text
target_nvme_transport_supported=tcp
target_nvme_rdma_supported=false
rdma_transport_rejection_test_seen=true
phase104_roce_live_io_result=blocked_target_transport_unsupported
roce_claim_allowed=false
roce_live_io_claim=false
```
## Non-Claims
Phase 104 does not claim:
- RoCE or NVMe/RDMA I/O works;
- Linux host can connect to Seaweed Block with `nvme connect -t rdma`;
- performance or SLO;
- multi-host failover.
## Next
The next phase should choose one path:
- implement a real NVMe/RDMA target/listener;
- continue with multi-host NVMe/TCP non-loopback topology;
- characterize NVMe/TCP performance.
@@ -242,9 +242,15 @@ rebuild, delete safety, or cleanup must start as a separate gated phase.
make a host a candidate, and missing RoCE hardware must surface as a
non-claim rather than a failed product gate. A candidate host is still not a
RoCE product claim until a live RoCE I/O gate passes.
- Next protocol candidates after Phase 103: RoCE live I/O on real RDMA
hardware, multi-host NVMe/TCP non-loopback topology, or NVMe performance
characterization. Keep these separate so correctness, transport, and
- Phase 104 RoCE Live-I/O Feasibility Boundary is complete. Because the current
NVMe target is explicitly TCP-only, this phase adds a machine-checkable
refusal: `--nvme-transport=rdma` must fail clearly and release wording must
keep RoCE as a non-claim. This is not a RoCE implementation.
- Phase 105 Multi-Host NVMe/TCP Topology Boundary is planned next. It should
block cross-node loopback NVMe/TCP publish targets before any multi-host NVMe
claim is made.
- Later protocol candidates: implement a real NVMe/RDMA target or characterize
NVMe/TCP performance. Keep these separate so correctness, transport, and
performance claims do not get mixed.
### Track E: Protocol / Backend Expansion
@@ -0,0 +1,63 @@
# Phase 104 RoCE Live-I/O Feasibility QA Sign-off
Status: PASS.
Validated source branch: `phase104-roce-live-io-feasibility`
Validated run:
```text
scenario=roce-live-io-feasibility-chain
run=20260629-002142-9c9e
result=PASS 10/10
```
## Local Contract
```text
bash -n scripts/run-phase104-roce-live-io-feasibility-gate.sh
C:\work\swblock.exe validate testops\scenarios\roce-live-io-feasibility-chain.yaml
go test ./cmd/blockvolume ./scripts ./internal/testops ./core/frontend/nvme -count=1
git diff --check
```
All checks passed.
## Live Evidence
Summary from the m02 run:
```text
phase104_roce_live_io_status=ok
phase104_scope=explicit_roce_transport_refusal_until_target_support_exists
read_only=true
target_nvme_transport_supported=tcp
target_nvme_rdma_supported=false
roce_claim_allowed=false
roce_live_io_claim=false
go_test_blockvolume_nvme=pass
rdma_transport_rejection_test_seen=true
phase104_roce_live_io_result=blocked_target_transport_unsupported
phase104_roce_live_io_gate_required_before_claim=true
```
## Verdict
Phase 104 correctly converts the Phase 103 RoCE candidate fact into an explicit
product boundary:
- `blockvolume` defaults to `--nvme-transport=tcp`;
- `--nvme-transport=rdma` is rejected before any target starts;
- the live gate records that the current target does not support NVMe/RDMA;
- no RoCE live-I/O or performance claim is emitted.
This is a PASS because it prevents a false RoCE claim. It is not a RoCE
implementation.
## Next
Choose one separate next phase:
- implement a real NVMe/RDMA target/listener;
- keep RoCE as a documented non-claim and move to multi-host NVMe/TCP;
- run NVMe/TCP performance characterization.
@@ -0,0 +1,59 @@
#!/usr/bin/env bash
set -euo pipefail
PRODUCT_ROOT="${1:-$(pwd)}"
ARTIFACT_DIR="${SW_BLOCK_ARTIFACT_DIR:-${PRODUCT_ROOT}/results/phase104-roce-live-io-feasibility-gate}"
SUMMARY="${ARTIFACT_DIR}/phase104-roce-live-io-feasibility-summary.txt"
mkdir -p "${ARTIFACT_DIR}"
: >"${SUMMARY}"
write_summary() {
echo "$*" | tee -a "${SUMMARY}" >/dev/null
}
select_go() {
if [[ -n "${GO_BIN:-}" ]]; then
GO_CMD=("${GO_BIN}")
return
fi
if command -v go.exe >/dev/null 2>&1; then
GO_CMD=(go.exe)
return
fi
GO_CMD=(go)
}
write_summary "phase104_roce_live_io_status=running"
write_summary "phase104_scope=explicit_roce_transport_refusal_until_target_support_exists"
write_summary "read_only=true"
write_summary "target_nvme_transport_supported=tcp"
write_summary "target_nvme_rdma_supported=false"
write_summary "roce_claim_allowed=false"
write_summary "roce_live_io_claim=false"
select_go
if ! "${GO_CMD[@]}" version >/dev/null 2>&1; then
write_summary "phase104_roce_live_io_status=blocked_missing_go"
exit 2
fi
write_summary "go_binary=${GO_CMD[*]}"
write_summary "go_version=$("${GO_CMD[@]}" version)"
(
cd "${PRODUCT_ROOT}"
"${GO_CMD[@]}" test -v ./cmd/blockvolume ./core/frontend/nvme -count=1
) >"${ARTIFACT_DIR}/go-test.log" 2>&1
write_summary "go_test_blockvolume_nvme=pass"
if grep -q "TestParseFlags_NVMeTransportRejectsRDMA" "${ARTIFACT_DIR}/go-test.log"; then
write_summary "rdma_transport_rejection_test_seen=true"
else
# Non-verbose go test may not print individual test names; the package PASS is
# still the gate. Keep this key explicit so readers don't infer live RDMA.
write_summary "rdma_transport_rejection_test_seen=false"
fi
write_summary "phase104_roce_live_io_result=blocked_target_transport_unsupported"
write_summary "phase104_roce_live_io_gate_required_before_claim=true"
write_summary "phase104_roce_live_io_status=ok"
@@ -192,6 +192,28 @@ func TestPhase103NVMeRoCEPreflightIsReadOnlyAndClaimBounded(t *testing.T) {
}
}
func TestPhase104RoCELiveIOFeasibilityGateIsExplicitRefusal(t *testing.T) {
root := repoRoot(t)
raw, err := os.ReadFile(filepath.Join(root, "scripts", "run-phase104-roce-live-io-feasibility-gate.sh"))
if err != nil {
t.Fatal(err)
}
script := string(raw)
for _, want := range []string{
"phase104_roce_live_io_status=",
"target_nvme_transport_supported=tcp",
"target_nvme_rdma_supported=false",
"phase104_roce_live_io_result=blocked_target_transport_unsupported",
"phase104_roce_live_io_gate_required_before_claim=true",
"roce_claim_allowed=false",
"roce_live_io_claim=false",
} {
if !strings.Contains(script, want) {
t.Fatalf("phase104 gate missing %q", want)
}
}
}
func repoRoot(t *testing.T) string {
t.Helper()
dir, err := os.Getwd()
@@ -0,0 +1,63 @@
name: roce-live-io-feasibility-chain
timeout: 15m
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: preflight
actions:
- action: exec
node: m02
timeout: 10m
cmd: "rm -rf /mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase104-roce-feasibility && mkdir -p /mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase104-roce-feasibility && cd {{ product_root }} && bash scripts/run-phase104-roce-live-io-feasibility-gate.sh {{ product_root }}"
env.SW_BLOCK_ARTIFACT_DIR: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase104-roce-feasibility/gate"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase104-roce-feasibility/gate/phase104-roce-live-io-feasibility-summary.txt"
pattern: "^phase104_roce_live_io_status=ok$"
save_as: phase104_ok
- action: assert_greater
actual: "{{ phase104_ok }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase104-roce-feasibility/gate/phase104-roce-live-io-feasibility-summary.txt"
pattern: "^target_nvme_rdma_supported=false$"
save_as: rdma_unsupported
- action: assert_greater
actual: "{{ rdma_unsupported }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase104-roce-feasibility/gate/phase104-roce-live-io-feasibility-summary.txt"
pattern: "^phase104_roce_live_io_result=blocked_target_transport_unsupported$"
save_as: blocked_unsupported
- action: assert_greater
actual: "{{ blocked_unsupported }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase104-roce-feasibility/gate/phase104-roce-live-io-feasibility-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 }}-phase104-roce-feasibility"
name: "remote-phases"
ignore_error: true