Merge pull request #56 from seaweedfs/phase105-nvme-tcp-multihost-topology

phase105: gate NVMe/TCP multi-host topology boundary
This commit is contained in:
Ping Qiu authored and GitHub committed 2026-06-29 00:39:07 -07:00
commit df05c5bf73
12 files changed
+534 -68

No files matched your search

@@ -545,6 +545,17 @@ func ManagedVolumeActionContract() []ManagedVolumeActionContractEntry {
InvariantRefs: []string{"INV-K8S-NONLOOPBACK-001"},
EvidenceRequired: "loopback_cross_node_evidence",
},
{
Type: ManagedVolumeActionInspectTargetTopology,
Master: MasterManagedVolume,
Mode: ManagedVolumeActionModeDryRun,
SideEffectClass: ManagedVolumeSideEffectObserve,
OwnerExecutor: "ops",
PolicyGate: ActionPolicyDryRun,
RequiredFacts: []string{"authority.publish_target", "placement.replica_node"},
InvariantRefs: []string{"INV-K8S-NONLOOPBACK-001"},
EvidenceRequired: "loopback_cross_node_evidence",
},
{
Type: ManagedVolumeActionImportCSIImage,
Master: MasterManagedVolume,
+25 -14
View File
@@ -59,6 +59,7 @@ const (
ManagedVolumeActionCollectBundle = "observe.collect_bundle"
ManagedVolumeActionVerifyCleanup = "observe.verify_cleanup"
ManagedVolumeActionReinstallExternalISCSI = "safe_k8s.reinstall_external_iscsi"
ManagedVolumeActionInspectTargetTopology = "observe.inspect_publish_target_topology"
ManagedVolumeActionWaitForPVCBound = "observe.wait_for_pvc_bound"
ManagedVolumeActionInspectMountFailure = "observe.inspect_mount_failure"
ManagedVolumeActionImportCSIImage = "safe_k8s.import_csi_image"
@@ -837,20 +838,7 @@ func managedVolumeActionsForProjection(p ManagedVolumeProjection, facts ManagedV
}}
switch p.ReasonCode {
case ReasonPublishTargetLoopbackCrossNode:
actions = append(actions, ManagedVolumeAction{
Type: ManagedVolumeActionReinstallExternalISCSI,
Target: facts.PVCName,
Mode: ManagedVolumeActionModeDryRun,
SideEffectClass: ManagedVolumeSideEffectSafeK8S,
OwnerExecutor: "installer_or_operator",
Preconditions: []string{
"multiple_kubernetes_nodes",
"loopback_publish_target",
"pod_scheduled_on_different_node",
},
InvariantRefs: []string{"INV-K8S-NONLOOPBACK-001"},
EvidenceRefs: append([]string(nil), p.EvidenceRefs...),
})
actions = append(actions, loopbackCrossNodeAction(p, facts))
case ReasonPVCUnbound:
actions = append(actions, ManagedVolumeAction{
Type: ManagedVolumeActionWaitForPVCBound,
@@ -944,6 +932,29 @@ func managedVolumeActionsForProjection(p ManagedVolumeProjection, facts ManagedV
return actions
}
func loopbackCrossNodeAction(p ManagedVolumeProjection, facts ManagedVolumeFacts) ManagedVolumeAction {
action := ManagedVolumeAction{
Type: ManagedVolumeActionReinstallExternalISCSI,
Target: facts.PVCName,
Mode: ManagedVolumeActionModeDryRun,
SideEffectClass: ManagedVolumeSideEffectSafeK8S,
OwnerExecutor: "installer_or_operator",
Preconditions: []string{
"multiple_kubernetes_nodes",
"loopback_publish_target",
"pod_scheduled_on_different_node",
},
InvariantRefs: []string{"INV-K8S-NONLOOPBACK-001"},
EvidenceRefs: append([]string(nil), p.EvidenceRefs...),
}
if p.NVMe != nil {
action.Type = ManagedVolumeActionInspectTargetTopology
action.SideEffectClass = ManagedVolumeSideEffectObserve
action.OwnerExecutor = "ops"
}
return action
}
func managedVolumeNonClaims(p ManagedVolumeProjection, facts ManagedVolumeFacts) []string {
var out []string
if hasTransparentHostPathEvidence(facts.HostPaths) {
@@ -255,6 +255,69 @@ func TestManagedVolumeProjection_LoopbackCrossNodeBlocked(t *testing.T) {
}
}
func TestManagedVolumeProjection_NVMeLoopbackCrossNodeBlocked(t *testing.T) {
projection := ProjectManagedVolume(ManagedVolumeFacts{
VolumeID: "pvc-nvme",
Namespace: "default",
PVCName: "nvme-pvc",
ReplicationFactor: 1,
Protocol: "nvme",
PVC: &PVCFact{
Phase: "Bound",
},
Authority: &AuthorityFact{
PrimaryReplica: "r1",
PublishTarget: "127.0.0.1:4420",
},
Replicas: []ReplicaFact{{
ReplicaID: "r1",
KubernetesNode: "m02",
Role: "primary",
Observed: true,
FrontendProtocol: "nvme",
FrontendAddr: "127.0.0.1:4420",
FrontendNQN: "nqn.2026-05.io.seaweedfs:pvc-nvme",
FrontendNSID: 1,
}},
CSIStages: []CSIStageFact{{
NodeName: "m01",
Target: "127.0.0.1:4420",
}},
PodMounts: []PodMountFact{{
PodName: "writer",
NodeName: "m01",
Phase: "Pending",
}},
})
if projection.Status != ManagedVolumeStatusBlocked || projection.ReasonCode != ReasonPublishTargetLoopbackCrossNode {
t.Fatalf("status=%s reason=%s", projection.Status, projection.ReasonCode)
}
ready := findObservationCondition(projection.Conditions, ConditionReady)
if ready == nil || ready.Status == "True" {
t.Fatalf("cross-node loopback nvme must not claim Ready=True: %+v", projection.Conditions)
}
if projection.NVMe == nil || projection.NVMe.Protocol != "nvme" || projection.NVMe.NVMeAddr != "127.0.0.1:4420" {
t.Fatalf("nvme status=%+v", projection.NVMe)
}
if hasManagedVolumeAction(projection.Actions, ManagedVolumeActionReinstallExternalISCSI) {
t.Fatalf("nvme topology blocker must not recommend iSCSI remediation: %+v", projection.Actions)
}
action := findManagedVolumeAction(projection.Actions, ManagedVolumeActionInspectTargetTopology)
if action == nil {
t.Fatalf("missing topology inspection action: %+v", projection.Actions)
}
if action.SideEffectClass != ManagedVolumeSideEffectObserve || action.OwnerExecutor != "ops" || action.Mode != ManagedVolumeActionModeDryRun {
t.Fatalf("action boundary=%+v", action)
}
if action.Decision != ManagedVolumeActionDecisionAllowed {
t.Fatalf("action decision=%s reason=%s missing=%v", action.Decision, action.DecisionReason, action.MissingFacts)
}
if action.EvidenceRequired != "loopback_cross_node_evidence" {
t.Fatalf("evidence_required=%q", action.EvidenceRequired)
}
}
func TestManagedVolumeProjection_PVCPendingBlocked(t *testing.T) {
projection := ProjectManagedVolume(ManagedVolumeFacts{
VolumeID: "pvc-pending",
@@ -128,6 +128,57 @@ func TestObservationReportSummaryAndHTMLIncludeManagedVolumeNVMeStatus(t *testin
}
}
func TestObservationReportSurfacesNVMeLoopbackCrossNodeWithoutISCSIAction(t *testing.T) {
cluster := NewClusterEvidence(time.Date(2026, 6, 29, 12, 0, 0, 0, time.UTC))
cluster.ManagedVolumes = []ManagedVolumeProjection{ProjectManagedVolume(ManagedVolumeFacts{
VolumeID: "pvc-nvme-loopback",
PVCName: "nvme-pvc",
Protocol: "nvme",
PVC: &PVCFact{Phase: "Bound"},
Authority: &AuthorityFact{
PrimaryReplica: "r1",
PublishTarget: "127.0.0.1:4420",
},
Replicas: []ReplicaFact{{
ReplicaID: "r1",
KubernetesNode: "m02",
Observed: true,
Role: "primary",
FrontendProtocol: "nvme",
FrontendAddr: "127.0.0.1:4420",
FrontendNQN: "nqn.2026-05.io.seaweedfs:pvc-nvme-loopback",
FrontendNSID: 1,
}},
CSIStages: []CSIStageFact{{
NodeName: "m01",
Target: "127.0.0.1:4420",
}},
})}
summary := RenderObservationReportSummary(cluster)
for _, want := range []string{
"managed_volume=pvc-nvme-loopback status=blocked reason=publish_target_loopback_cross_node",
"managed_volume_nvme=pvc-nvme-loopback nqn=nqn.2026-05.io.seaweedfs:pvc-nvme-loopback nsid=1 addr=127.0.0.1:4420",
"managed_volume_condition=Ready status=False reason=publish_target_loopback_cross_node",
"managed_volume_action=observe.inspect_publish_target_topology mode=dry_run side_effect=observe executor=ops decision=allowed",
} {
if !strings.Contains(summary, want) {
t.Fatalf("summary missing %q:\n%s", want, summary)
}
}
if strings.Contains(summary, ManagedVolumeActionReinstallExternalISCSI) {
t.Fatalf("summary must not recommend iSCSI remediation for NVMe topology:\n%s", summary)
}
explain := RenderObservationExplainText(cluster)
if !strings.Contains(explain, "managed_volume_action observe.inspect_publish_target_topology mode=dry_run side_effect=observe executor=ops decision=allowed") {
t.Fatalf("explain missing topology action:\n%s", explain)
}
if strings.Contains(explain, ManagedVolumeActionReinstallExternalISCSI) {
t.Fatalf("explain must not recommend iSCSI remediation for NVMe topology:\n%s", explain)
}
}
func TestObservationReportSummary_IncludesReturnedReplicaProjection(t *testing.T) {
cluster := NewClusterEvidence(time.Date(2026, 6, 18, 12, 0, 0, 0, time.UTC))
cluster.ManagedVolumes = []ManagedVolumeProjection{ProjectManagedVolume(ManagedVolumeFacts{
+22
View File
@@ -96,6 +96,8 @@ Seaweed Block can already demonstrate a narrow Kubernetes block-storage loop:
- NVMe/TCP CSI multipath attach is gated for the supported lab path; RoCE and
NVMe/RDMA remain explicit non-claims until host preflight plus live I/O gates
prove them.
- Cross-node loopback NVMe/TCP topology is explicitly blocked. Cross-node
non-loopback NVMe/TCP attach remains the next live gate, not a shipped claim.
- Install drift status for current versus desired chart/app/image identity
without upgrade execution.
- CRD/RBAC status-writer conformance coverage for the failures that previously
@@ -481,6 +483,26 @@ Recommended order from here:
and runs the Phase 101 standalone hardening gates using binaries extracted
from the published `seaweed-block` image. If images are missing, the gate
blocks as an artifact-readiness issue, not a product failure.
61. Phase 103: NVMe Multi-Host / RoCE Preflight. **Closed 2026-06-29,
runner PASS**
Adds a read-only host capability gate for NVMe/TCP and RoCE candidacy. RDMA
hardware plus `nvme-rdma` module availability can make a host a candidate,
but still does not permit a RoCE or performance product claim.
62. Phase 104: RoCE Live-I/O Feasibility Boundary. **Closed 2026-06-29,
runner PASS**
Makes the current target boundary explicit: `--nvme-transport=rdma` is
rejected because only NVMe/TCP is implemented. This is a refusal gate, not a
RoCE implementation.
63. Phase 105: NVMe/TCP Multi-Host Topology Boundary. **Closed 2026-06-29,
runner PASS**
Cross-node loopback NVMe/TCP evidence now blocks with
`publish_target_loopback_cross_node`, never emits false `Ready=True`, and
surfaces the read-only `observe.inspect_publish_target_topology` action
instead of an iSCSI remediation.
64. Phase 106: NVMe/TCP Cross-Node Non-Loopback Live Attach. **Planned**
Prove the positive multi-host path with a routable NVMe/TCP target, CSI
publish/stage agreement, app writer/reader I/O, and zero residue. This still
excludes RoCE, performance/SLO, broad compatibility, and production HA.
The internal release-train contract is
`internal/docs/ref/operation-layer-v0.5-release-train.md`. Phases 41-44 close
+56 -50
View File
@@ -1,94 +1,100 @@
# Current Plan: Phase 105 Multi-Host NVMe/TCP Topology Boundary
# Current Plan: Phase 106 NVMe/TCP Cross-Node Non-Loopback Live Attach
Status: planned next.
## Why This Is Next
Phase 103 proved host transport preflight. Phase 104 proved the current product
is explicitly NVMe/TCP-only and must not claim RoCE/NVMe-RDMA.
Phase 103 proved the host can support NVMe/TCP preflight. Phase 104 proved the
product must not claim RoCE/NVMe-RDMA. Phase 105 proved the topology boundary:
cross-node loopback NVMe/TCP evidence is blocked with
`publish_target_loopback_cross_node`, no false `Ready=True`, and no iSCSI-only
remediation.
The next useful NVMe feature is therefore not RoCE and not performance. It is
multi-host NVMe/TCP topology correctness:
The next useful NVMe feature is therefore the positive live path that Phase 105
explicitly did not claim:
```text
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
blockvolume publishes a non-loopback NVMe/TCP target on node B
CSI stages it for a workload on node A
writer/reader I/O succeeds
status surfaces Ready only after live evidence
```
This mirrors the earlier iSCSI loopback-cross-node blocker, but for NVMe/TCP.
## Product Goal
Add a topology boundary that distinguishes:
Make cross-node NVMe/TCP attach a real gated capability for the lab path, not a
model-only promise.
- 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.
Required behavior:
The intended reason code is:
- loopback target across nodes stays blocked by Phase 105;
- non-loopback target across nodes can be staged by CSI;
- the published NQN/NSID/address in master status, CSI publish context, node
stage evidence, report, dashboard, and CRD status agree;
- app writer/reader verifies data through the mounted volume;
- cleanup leaves zero Kubernetes, NVMe, process, and host residue.
```text
nvme_publish_target_loopback_cross_node
```
## D1: Publish Target Selection
or a reused protocol-neutral reason if the existing model can carry it cleanly.
## D1: Model / Reason Contract
Define how ManagedVolume facts represent an NVMe publish target whose address is
loopback while the workload node differs from the blockvolume node.
Ensure NVMe frontend publication exposes a routable node address when the
workload may run on a different node. Do not regress the same-node loopback lab
path.
Required local checks:
```text
go test ./core/ops ./cmd/sw-block -count=1
go test ./core/frontend/nvme ./core/ops ./cmd/blockvolume ./cmd/sw-block -count=1
```
## D2: Report / Dashboard / Explain Agreement
## D2: CSI Publish / Stage Evidence
The blocked state must appear consistently in:
Confirm CSI publish context carries the non-loopback NVMe/TCP target and node
stage records the same NQN/NSID/address.
- summary.txt;
- operator-snapshot.json;
- dashboard `/operator-snapshot.json`;
- `ops explain`;
- CRD status if the operator-status path consumes the same evidence.
No status surface may claim Ready if publish context and stage evidence
disagree.
No surface may show `Ready=True` for cross-node loopback NVMe/TCP.
## D3: Live Cross-Node Writer / Reader Gate
## D3: TestOps Scenario
Add a scenario/gate that crafts or induces:
Run a TestOps scenario that pins or schedules:
```text
protocol=nvme
publish_target=127.0.0.1:<port>
blockvolume_node=m02
workload_node=m01
publish_target=<m02 routable IP>:4420
protocol=nvme
```
Expected evidence:
```text
status=blocked
reason=nvme_publish_target_loopback_cross_node
ready_true_count=0
safe action is observe/read_only or dry_run
writer_verified=true
reader_verified=true
status=ready
reason=first_volume_verified
nvme_target_loopback=false
ready_true_allowed_only_after_reader=true
```
## D4: Live Follow-up
## D4: Negative Regression
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.
Keep the Phase 105 negative topology scenario in the suite:
```text
publish_target=127.0.0.1:4420
blockvolume_node=m02
workload_node=m01
status=blocked
reason=publish_target_loopback_cross_node
ready_true_count=0
```
## Non-Claims
Phase 105 does not claim:
Phase 106 still does not claim:
- multi-host NVMe/TCP attach works;
- RoCE/NVMe-RDMA works;
- RoCE/NVMe-RDMA;
- multi-path failover across real hosts;
- performance or SLO;
- broad distro/kernel compatibility;
- production HA.
@@ -0,0 +1,65 @@
# Phase 105 Finished Plan: NVMe/TCP Multi-Host Topology Boundary
Status: closed, QA PASS.
## Problem
After Phase 104, the product was correctly explicit that NVMe/RDMA is not
implemented. The remaining NVMe multi-host risk was topology: a loopback
NVMe/TCP publish target must not be handed to a workload on a different
Kubernetes node.
This is the same safety class as the earlier iSCSI loopback-cross-node blocker,
but the action surface must not recommend iSCSI remediation for NVMe evidence.
## What Changed
- Reused the existing protocol-neutral reason:
`publish_target_loopback_cross_node`.
- Added `observe.inspect_publish_target_topology` as a read-only/dry-run action
for NVMe topology blockers.
- Kept existing iSCSI behavior unchanged:
`safe_k8s.reinstall_external_iscsi`.
- Added projection and report/explain tests proving:
- cross-node loopback NVMe/TCP is blocked;
- `Ready=True` is not emitted;
- NVMe status is preserved;
- iSCSI remediation is not surfaced for NVMe.
- Added a TestOps scenario:
`testops/scenarios/nvme-tcp-multihost-topology-chain.yaml`.
## Verification
Local:
```text
go test ./scripts ./internal/testops ./core/ops ./cmd/sw-block ./core/frontend/nvme -count=1
C:\work\swblock.exe validate testops\scenarios\nvme-tcp-multihost-topology-chain.yaml
bash -n scripts/run-phase105-nvme-tcp-multihost-topology-gate.sh
```
Remote TestOps:
```text
scenario: testops/scenarios/nvme-tcp-multihost-topology-chain.yaml
run: 20260629-003451-6c16
result: 18/18 PASS
```
Terminal evidence:
```text
phase105_nvme_tcp_multihost_topology_status=ok
nvme_cross_node_loopback_status=blocked
nvme_cross_node_loopback_reason=publish_target_loopback_cross_node
ready_true_count=0
safe_action=observe.inspect_publish_target_topology
iscsi_remediation_recommended=false
live_io_claim=false
roce_claim_allowed=false
```
## Remaining Work
Phase 106 should prove the positive live path: cross-node non-loopback NVMe/TCP
publish target, CSI stage, and app writer/reader verification.
@@ -236,7 +236,7 @@ rebuild, delete safety, or cleanup must start as a separate gated phase.
`seaweed-block-csi` image pair can run the Phase 100 Kubernetes NVMe
multipath attach gate and that binaries extracted from the published
`seaweed-block` image pass the Phase 101 standalone hardening gates.
- Phase 103 NVMe Multi-Host / RoCE Preflight is active. It adds a read-only host
- Phase 103 NVMe Multi-Host / RoCE Preflight is closed. It adds a read-only host
capability gate before any RoCE, multi-host, or performance claim: NVMe/TCP
capability must be inspectable, RDMA devices and `nvme-rdma` capability can
make a host a candidate, and missing RoCE hardware must surface as a
@@ -246,9 +246,14 @@ rebuild, delete safety, or cleanup must start as a separate gated phase.
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.
- Phase 105 Multi-Host NVMe/TCP Topology Boundary is closed. It blocks
cross-node loopback NVMe/TCP evidence with the existing protocol-neutral
`publish_target_loopback_cross_node` reason, keeps `Ready=True` false, and
surfaces `observe.inspect_publish_target_topology` instead of an iSCSI-only
remediation.
- Phase 106 NVMe/TCP Cross-Node Non-Loopback Live Attach is next. It should
prove the positive multi-host path: a routable NVMe/TCP target, CSI
stage/publish agreement, app writer/reader I/O, and zero residue.
- 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.
@@ -0,0 +1,70 @@
# Phase 105 NVMe/TCP Multi-Host Topology Boundary QA Sign-off
Status: PASS.
Source branch: `phase105-nvme-tcp-multihost-topology`.
QA run:
```text
scenario: testops/scenarios/nvme-tcp-multihost-topology-chain.yaml
run: 20260629-003451-6c16
result: 18/18 PASS
node: m02
```
## Scope
Phase 105 is a topology-boundary gate. It does not attempt live NVMe/TCP data
I/O. It proves that cross-node loopback NVMe/TCP evidence is blocked and that
the user-facing action is protocol-appropriate.
## Evidence
```text
phase105_nvme_tcp_multihost_topology_status=ok
read_only=true
live_io_claim=false
performance_claim_allowed=false
roce_claim_allowed=false
reason_code=publish_target_loopback_cross_node
expected_action=observe.inspect_publish_target_topology
forbidden_action=safe_k8s.reinstall_external_iscsi
go_test_core_ops=pass
nvme_cross_node_loopback_status=blocked
nvme_cross_node_loopback_reason=publish_target_loopback_cross_node
ready_true_count=0
safe_action=observe.inspect_publish_target_topology
iscsi_remediation_recommended=false
same_node_loopback_non_claim=true
cross_node_non_loopback_live_followup=true
```
## Result
The model keeps the existing protocol-neutral reason
`publish_target_loopback_cross_node`. That is the right status vocabulary: the
unsafe topology is identical regardless of frontend protocol.
The action surface is now protocol-aware:
- iSCSI loopback-cross-node keeps the existing
`safe_k8s.reinstall_external_iscsi` dry-run recommendation.
- NVMe/TCP loopback-cross-node uses
`observe.inspect_publish_target_topology`.
No surface may tell an NVMe user to run an iSCSI remediation. The regression is
covered by both direct projection tests and report/explain tests.
## Non-Claims
Phase 105 does not claim:
- cross-node NVMe/TCP attach works;
- RoCE/NVMe-RDMA works;
- live NVMe/TCP I/O;
- performance or SLO;
- production HA.
The next phase should prove the positive live path: cross-node non-loopback
NVMe/TCP attach with writer/reader verification.
@@ -0,0 +1,37 @@
#!/usr/bin/env bash
set -euo pipefail
PRODUCT_ROOT="${1:-$(pwd)}"
ARTIFACT_DIR="${SW_BLOCK_ARTIFACT_DIR:-${PRODUCT_ROOT}/results/phase105-nvme-tcp-multihost-topology-gate}"
SUMMARY="${ARTIFACT_DIR}/phase105-nvme-tcp-multihost-topology-summary.txt"
mkdir -p "${ARTIFACT_DIR}"
: >"${SUMMARY}"
write_summary() {
echo "$*" | tee -a "${SUMMARY}" >/dev/null
}
write_summary "phase105_nvme_tcp_multihost_topology_status=running"
write_summary "read_only=true"
write_summary "live_io_claim=false"
write_summary "performance_claim_allowed=false"
write_summary "roce_claim_allowed=false"
write_summary "reason_code=publish_target_loopback_cross_node"
write_summary "expected_action=observe.inspect_publish_target_topology"
write_summary "forbidden_action=safe_k8s.reinstall_external_iscsi"
(
cd "${PRODUCT_ROOT}"
go test ./core/ops -run 'TestManagedVolumeProjection_NVMeLoopbackCrossNodeBlocked|TestObservationReportSurfacesNVMeLoopbackCrossNodeWithoutISCSIAction' -count=1
) >"${ARTIFACT_DIR}/go-test-core-ops.log" 2>&1
write_summary "go_test_core_ops=pass"
write_summary "nvme_cross_node_loopback_status=blocked"
write_summary "nvme_cross_node_loopback_reason=publish_target_loopback_cross_node"
write_summary "ready_true_count=0"
write_summary "safe_action=observe.inspect_publish_target_topology"
write_summary "iscsi_remediation_recommended=false"
write_summary "same_node_loopback_non_claim=true"
write_summary "cross_node_non_loopback_live_followup=true"
write_summary "phase105_nvme_tcp_multihost_topology_status=ok"
@@ -214,6 +214,36 @@ func TestPhase104RoCELiveIOFeasibilityGateIsExplicitRefusal(t *testing.T) {
}
}
func TestPhase105NVMETCPMultiHostTopologyGateIsReadOnlyAndClaimBounded(t *testing.T) {
root := repoRoot(t)
raw, err := os.ReadFile(filepath.Join(root, "scripts", "run-phase105-nvme-tcp-multihost-topology-gate.sh"))
if err != nil {
t.Fatal(err)
}
script := string(raw)
for _, want := range []string{
"phase105_nvme_tcp_multihost_topology_status=",
"read_only=true",
"live_io_claim=false",
"performance_claim_allowed=false",
"roce_claim_allowed=false",
"reason_code=publish_target_loopback_cross_node",
"safe_action=observe.inspect_publish_target_topology",
"iscsi_remediation_recommended=false",
"same_node_loopback_non_claim=true",
"cross_node_non_loopback_live_followup=true",
} {
if !strings.Contains(script, want) {
t.Fatalf("phase105 gate missing %q", want)
}
}
for _, forbidden := range []string{"nvme connect", "nvme disconnect", "kubectl patch", "kubectl delete"} {
if strings.Contains(script, forbidden) {
t.Fatalf("phase105 gate should be read-only, found %q", forbidden)
}
}
}
func repoRoot(t *testing.T) string {
t.Helper()
dir, err := os.Getwd()
@@ -0,0 +1,95 @@
name: nvme-tcp-multihost-topology-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: topology_gate
actions:
- action: exec
node: m02
timeout: 10m
cmd: "rm -rf /mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase105-nvme-topology && mkdir -p /mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase105-nvme-topology && cd {{ product_root }} && bash scripts/run-phase105-nvme-tcp-multihost-topology-gate.sh {{ product_root }}"
env.SW_BLOCK_ARTIFACT_DIR: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase105-nvme-topology/gate"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase105-nvme-topology/gate/phase105-nvme-tcp-multihost-topology-summary.txt"
pattern: "^phase105_nvme_tcp_multihost_topology_status=ok$"
save_as: phase105_ok
- action: assert_greater
actual: "{{ phase105_ok }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase105-nvme-topology/gate/phase105-nvme-tcp-multihost-topology-summary.txt"
pattern: "^read_only=true$"
save_as: read_only
- action: assert_greater
actual: "{{ read_only }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase105-nvme-topology/gate/phase105-nvme-tcp-multihost-topology-summary.txt"
pattern: "^nvme_cross_node_loopback_status=blocked$"
save_as: blocked
- action: assert_greater
actual: "{{ blocked }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase105-nvme-topology/gate/phase105-nvme-tcp-multihost-topology-summary.txt"
pattern: "^nvme_cross_node_loopback_reason=publish_target_loopback_cross_node$"
save_as: reason
- action: assert_greater
actual: "{{ reason }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase105-nvme-topology/gate/phase105-nvme-tcp-multihost-topology-summary.txt"
pattern: "^ready_true_count=0$"
save_as: no_ready_true
- action: assert_greater
actual: "{{ no_ready_true }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase105-nvme-topology/gate/phase105-nvme-tcp-multihost-topology-summary.txt"
pattern: "^safe_action=observe.inspect_publish_target_topology$"
save_as: action
- action: assert_greater
actual: "{{ action }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase105-nvme-topology/gate/phase105-nvme-tcp-multihost-topology-summary.txt"
pattern: "^iscsi_remediation_recommended=false$"
save_as: no_iscsi_action
- action: assert_greater
actual: "{{ no_iscsi_action }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase105-nvme-topology/gate/phase105-nvme-tcp-multihost-topology-summary.txt"
pattern: "^live_io_claim=false$"
save_as: no_live_io_claim
- action: assert_greater
actual: "{{ no_live_io_claim }}"
threshold: "0"
- name: collect
always: true
actions:
- action: collect_path
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase105-nvme-topology"
name: "remote-phases"
ignore_error: true