From c23aacbece5cf4a153e2e3688f90fd63c9fe7583 Mon Sep 17 00:00:00 2001 From: pingqiu Date: Fri, 3 Jul 2026 17:38:46 -0700 Subject: [PATCH] phase129: reconnect mounted nvme restage paths --- seaweed-block/core/csi/node.go | 105 ++++++++++++++ seaweed-block/core/csi/node_test.go | 131 ++++++++++++++++++ .../docs/releases/nvme-tcp-supported-lab.md | 21 ++- seaweed-block/docs/roadmap.md | 18 ++- seaweed-block/internal/docs/current-plan.md | 85 ++++++------ ...9_finishedplan_nvme_k8s_mounted_restage.md | 67 +++++++++ .../internal/docs/product-roadmap.md | 11 +- ...129-nvme-k8s-mounted-restage-qa-signoff.md | 67 +++++++++ ...-phase129-nvme-k8s-mounted-restage-gate.sh | 69 +++++++++ .../nvme-k8s-mounted-restage-chain.yaml | 62 +++++++++ 10 files changed, 586 insertions(+), 50 deletions(-) create mode 100644 seaweed-block/internal/docs/finished-plans/phase129_finishedplan_nvme_k8s_mounted_restage.md create mode 100644 seaweed-block/internal/docs/qa-assignments/phase129-nvme-k8s-mounted-restage-qa-signoff.md create mode 100644 seaweed-block/scripts/run-phase129-nvme-k8s-mounted-restage-gate.sh create mode 100644 seaweed-block/testops/scenarios/nvme-k8s-mounted-restage-chain.yaml diff --git a/seaweed-block/core/csi/node.go b/seaweed-block/core/csi/node.go index f1e8f18c21..08e1f3efe3 100644 --- a/seaweed-block/core/csi/node.go +++ b/seaweed-block/core/csi/node.go @@ -139,6 +139,15 @@ func (s *NodeServer) NodeStageVolume(ctx context.Context, req *csipb.NodeStageVo if err := s.validateMountedStagingVolume(volumeID, stagingPath); err != nil { return nil, err } + transport := transportFromContext(req.GetPublishContext(), req.GetVolumeContext()) + if transport == "" { + transport = readTransportFile(stagingPath) + } + if transport == transportNVMe || readTransportFile(stagingPath) == transportNVMe { + if err := s.reconcileMountedNVMePaths(ctx, req, volumeID, stagingPath); err != nil { + return nil, err + } + } s.logger.Printf("NodeStageVolume: %s already mounted at %s", volumeID, stagingPath) return &csipb.NodeStageVolumeResponse{}, nil } @@ -399,6 +408,102 @@ func (s *NodeServer) stageNVMe(ctx context.Context, req *csipb.NodeStageVolumeRe return &csipb.NodeStageVolumeResponse{}, nil } +func (s *NodeServer) reconcileMountedNVMePaths(ctx context.Context, req *csipb.NodeStageVolumeRequest, volumeID, stagingPath string) error { + if s.nvmeUtil == nil { + return status.Error(codes.FailedPrecondition, "NVMe attach utility is not configured") + } + publish := s.refreshPublishContext(ctx, volumeID, req.GetPublishContext()) + publishContext := publish.Context + multipathRequested := iscsiMultipathFromContext(publishContext) || iscsiMultipathFromContext(req.GetPublishContext()) || iscsiMultipathFromContext(req.GetVolumeContext()) + if multipathRequested { + publish = s.waitForNVMeMultipathPublishContext(ctx, volumeID, publish, 2) + publishContext = publish.Context + } + addr, nqn := nvmeFromContext(publishContext) + addrs := nvmeAddrsFromContext(publishContext) + if addr == "" || nqn == "" { + addr, nqn = nvmeFromContext(req.GetVolumeContext()) + addrs = nvmeAddrsFromContext(req.GetVolumeContext()) + } + if addr == "" || nqn == "" { + return nil + } + if len(addrs) == 0 { + addrs = []string{addr} + } + existingNQN := readTargetFile(stagingPath) + if existingNQN != "" && existingNQN != nqn { + return status.Errorf(codes.FailedPrecondition, "mounted NVMe staging target mismatch: got %q want %q", existingNQN, nqn) + } + if multipathRequested && len(addrs) < 2 { + return status.Errorf(codes.FailedPrecondition, "NVMe multipath requires at least two portals, got %d", len(addrs)) + } + + connectAllPaths := multipathRequested || len(addrs) > 1 + connectedNewPath := false + if connectAllPaths { + for _, pathAddr := range addrs { + pathConnected, err := s.nvmeUtil.IsPathConnected(ctx, nqn, pathAddr) + if err != nil { + return status.Errorf(codes.Internal, "check nvme path connect: %v", err) + } + if pathConnected { + continue + } + if err := s.nvmeUtil.Connect(ctx, pathAddr, nqn); err != nil { + return status.Errorf(codes.Internal, "nvme reconnect path: %v", err) + } + connectedNewPath = true + } + for _, pathAddr := range addrs { + pathConnected, err := s.nvmeUtil.IsPathConnected(ctx, nqn, pathAddr) + if err != nil { + return status.Errorf(codes.Internal, "verify nvme path connect: %v", err) + } + if !pathConnected { + return status.Errorf(codes.FailedPrecondition, "NVMe multipath %q missing path %s", nqn, pathAddr) + } + } + } else { + connected, err := s.nvmeUtil.IsConnected(ctx, nqn) + if err != nil { + return status.Errorf(codes.Internal, "check nvme connect: %v", err) + } + if !connected { + if err := s.nvmeUtil.Connect(ctx, addr, nqn); err != nil { + return status.Errorf(codes.Internal, "nvme reconnect: %v", err) + } + connectedNewPath = true + } + } + + if err := writeTransportFile(stagingPath, transportNVMe); err != nil { + s.logger.Printf("NodeStageVolume: %s: %v (non-fatal)", volumeID, err) + } + if err := writeVolumeFile(stagingPath, volumeID); err != nil { + s.logger.Printf("NodeStageVolume: %s: %v (non-fatal)", volumeID, err) + } + if err := writeTargetFile(stagingPath, nqn); err != nil { + s.logger.Printf("NodeStageVolume: %s: %v (non-fatal)", volumeID, err) + } + + s.stagedMu.Lock() + s.staged[volumeID] = &stagedVolumeInfo{ + nqn: nqn, + nvmeAddr: addr, + nvmeAddrs: append([]string(nil), addrs...), + multipath: len(addrs) > 1, + transport: transportNVMe, + stagingPath: stagingPath, + } + s.stagedMu.Unlock() + if connectedNewPath { + s.logger.Printf("NodeStageVolume: %s reconciled mounted NVMe paths portals=%s target=%s", volumeID, strings.Join(addrs, ","), nqn) + s.reportCSIReattachObserved(ctx, volumeID, transportNVMe, addr, publish) + } + return nil +} + func (s *NodeServer) reportCSIReattachObserved(ctx context.Context, volumeID, transport, targetAddr string, publish publishContextResult) { if s.events == nil { return diff --git a/seaweed-block/core/csi/node_test.go b/seaweed-block/core/csi/node_test.go index fade365ac2..540e797a50 100644 --- a/seaweed-block/core/csi/node_test.go +++ b/seaweed-block/core/csi/node_test.go @@ -971,6 +971,137 @@ func TestNodeStage_IdempotentWhenAlreadyMounted(t *testing.T) { } } +func TestNodeStage_MountedNVMeReconnectsMissingPublishedPath(t *testing.T) { + _, mn, mm := newMockISCSIUtil(), newMockNVMeUtil(), newMockMountUtil() + nqn := "nqn.2026-05.io.seaweedfs:v1" + oldAddr := "127.0.0.1:4420" + newAddr := "127.0.0.1:4421" + mn.connected[nqn] = true + mn.connectedPaths[nqn+"|"+oldAddr] = true + lookup := &sequenceLookup{targets: []PublishTarget{{ + VolumeID: "v1", + ReplicaID: "r1", + Protocol: ProtocolNVMe, + NVMeAddr: oldAddr, + NVMeAddrs: []string{oldAddr, newAddr}, + NQN: nqn, + NSID: 1, + Multipath: true, + }}} + reporter := &recordingEventReporter{} + ns := NewNodeServer(NodeConfig{ + NodeID: "node-a", + IQNPrefix: "iqn.2026-05.example.v3", + NVMeUtil: mn, + MountUtil: mm, + Lookup: lookup, + EventReporter: reporter, + }) + staging := t.TempDir() + mm.mounted[staging] = true + if err := writeTransportFile(staging, transportNVMe); err != nil { + t.Fatal(err) + } + if err := writeVolumeFile(staging, "v1"); err != nil { + t.Fatal(err) + } + if err := writeTargetFile(staging, nqn); err != nil { + t.Fatal(err) + } + ns.staged["v1"] = &stagedVolumeInfo{ + nqn: nqn, + nvmeAddr: oldAddr, + nvmeAddrs: []string{oldAddr}, + transport: transportNVMe, + stagingPath: staging, + } + + _, err := ns.NodeStageVolume(context.Background(), &csipb.NodeStageVolumeRequest{ + VolumeId: "v1", + StagingTargetPath: staging, + VolumeCapability: testVolumeCapability(), + PublishContext: map[string]string{ + "protocol": "nvme", + "nvmeAddr": oldAddr, + "nqn": nqn, + "stage2_multipath": "true", + }, + VolumeContext: map[string]string{ + "stage2_multipath": "true", + }, + }) + if err != nil { + t.Fatalf("NodeStageVolume: %v", err) + } + for _, want := range []string{ + "ispathconnected:" + oldAddr + ":" + nqn, + "ispathconnected:" + newAddr + ":" + nqn, + "connect:" + newAddr + ":" + nqn, + } { + found := false + for _, call := range mn.calls { + if call == want { + found = true + break + } + } + if !found { + t.Fatalf("missing %q in nvme calls=%v", want, mn.calls) + } + } + for _, call := range mm.calls { + if strings.HasPrefix(call, "formatandmount:") { + t.Fatalf("mounted restage must not format/mount, mount calls=%v", mm.calls) + } + } + info := ns.staged["v1"] + if info == nil || !info.multipath || len(info.nvmeAddrs) != 2 || info.nvmeAddrs[1] != newAddr { + t.Fatalf("staged info=%+v", info) + } + if len(reporter.events) != 1 || reporter.events[0].Type != EventTypeCSIReattachObserved { + t.Fatalf("events=%+v", reporter.events) + } +} + +func TestNodeStage_MountedNVMeRejectsTargetMismatch(t *testing.T) { + _, mn, mm := newMockISCSIUtil(), newMockNVMeUtil(), newMockMountUtil() + ns := newTestNodeWithNVMe(newMockISCSIUtil(), mn, mm) + staging := t.TempDir() + mm.mounted[staging] = true + if err := writeTransportFile(staging, transportNVMe); err != nil { + t.Fatal(err) + } + if err := writeVolumeFile(staging, "v1"); err != nil { + t.Fatal(err) + } + if err := writeTargetFile(staging, "nqn.2026-05.io.seaweedfs:v1"); err != nil { + t.Fatal(err) + } + + _, err := ns.NodeStageVolume(context.Background(), &csipb.NodeStageVolumeRequest{ + VolumeId: "v1", + StagingTargetPath: staging, + VolumeCapability: testVolumeCapability(), + PublishContext: map[string]string{ + "protocol": "nvme", + "nvmeAddr": "127.0.0.1:4420", + "nqn": "nqn.2026-05.io.seaweedfs:other", + }, + }) + if err == nil { + t.Fatal("expected mounted NVMe target mismatch to fail") + } + st, _ := status.FromError(err) + if st.Code() != codes.FailedPrecondition { + t.Fatalf("code=%v want FailedPrecondition err=%v", st.Code(), err) + } + for _, call := range mn.calls { + if strings.HasPrefix(call, "connect:") { + t.Fatalf("must fail before connecting mismatched target, calls=%v", mn.calls) + } + } +} + func TestNodeStage_FailsClosedWhenStagingPathMountedForAnotherVolume(t *testing.T) { mi, mm := newMockISCSIUtil(), newMockMountUtil() ns := newTestNode(mi, mm) diff --git a/seaweed-block/docs/releases/nvme-tcp-supported-lab.md b/seaweed-block/docs/releases/nvme-tcp-supported-lab.md index 30ade7b11b..daa2ff7f02 100644 --- a/seaweed-block/docs/releases/nvme-tcp-supported-lab.md +++ b/seaweed-block/docs/releases/nvme-tcp-supported-lab.md @@ -66,6 +66,7 @@ The supported-lab claim is intentionally narrow: | 126 | Block NVMe/TCP backend write instrumentation with product-owned counters | PASS | | 127 | OAES ANA Change Notice source/component gate | PASS | | 128 | Live Linux host ANA Change Notice AER gate | PASS | +| 129 | CSI mounted NVMe restage contract | PASS | Key QA sign-offs: @@ -78,6 +79,7 @@ Key QA sign-offs: - `internal/docs/qa-assignments/phase126-block-nvme-tcp-backend-write-instrumentation-qa-signoff.md` - `internal/docs/qa-assignments/phase127-nvme-ana-change-notice-qa-signoff.md` - `internal/docs/qa-assignments/phase128-nvme-ana-change-notice-host-qa-signoff.md` +- `internal/docs/qa-assignments/phase129-nvme-k8s-mounted-restage-qa-signoff.md` ## Performance Baseline @@ -230,7 +232,24 @@ cleanup_status=ok This proves the standalone Linux NVMe/TCP initiator sees the ANA Change Notice through the kernel `nvme_async_event` tracepoint during r1->r2 failover. It is -still not a Kubernetes dynamic reconnect/restage claim; Phase 129 owns that. +still not a Kubernetes dynamic reconnect/restage claim. + +Phase 129 closes the mounted restage primitive, not the automatic trigger: + +```text +mounted_nodestage_reconnects_missing_path=true +mounted_nodestage_rejects_nqn_mismatch=true +mounted_nodestage_does_not_remount=true +restage_owner=node_stage +host_mutation_scope=nvme_connect_missing_paths_only +automatic_k8s_reconnect_claim=false +automatic_trigger_required_next=true +cleanup_status=ok +``` + +The remaining gap is now narrower: Phase 130 must prove the owner/trigger that +detects desired NVMe path-set changes for an already-mounted PVC and invokes +the bounded restage path. ## Representative Release Smoke diff --git a/seaweed-block/docs/roadmap.md b/seaweed-block/docs/roadmap.md index e456861820..4af0f3b731 100644 --- a/seaweed-block/docs/roadmap.md +++ b/seaweed-block/docs/roadmap.md @@ -706,12 +706,18 @@ Recommended order from here: Notice / ANA Change / ANA log page; OAES ANA Change Notice was advertised, the ANA log change count advanced from `4294967297` to `8589934593`, host path state refreshed, mounted I/O remained correct, and cleanup was clean. -87. Phase 129: Kubernetes NVMe Dynamic Reconnect / Restage. **Active** - Prove the Kubernetes CSI path can safely react when a mounted PVC's - published NVMe path set changes: stale host paths removed, replacement - paths connected, CRD/report/dashboard evidence agrees, and mounted I/O - remains correct. NVMe/RDMA, performance SLOs, and backend write - optimization remain separate non-claims. +87. Phase 129: Kubernetes NVMe Mounted Restage Contract. **Closed 2026-07-03, + runner PASS** + Closed the necessary CSI node-side restage contract: if `NodeStageVolume` + is invoked again for an already-mounted NVMe staging path, the node plugin + refreshes publish context, connects missing NVMe paths for the same NQN, + rejects mounted NQN mismatch, and does not remount or reformat. This phase + deliberately does not claim an automatic Kubernetes reconnect trigger. +88. Phase 130: Kubernetes NVMe Reconnect Owner / Trigger Gate. **Active** + Prove the live owner/trigger that notices a mounted PVC's desired NVMe path + set changed and invokes the bounded reconnect/restage path. This must name + the owner, prove replacement path connection, keep pod identity and mounted + I/O correct, and keep stale-path disconnect claims honest. 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 332db1be8d..7fc063d7e1 100644 --- a/seaweed-block/internal/docs/current-plan.md +++ b/seaweed-block/internal/docs/current-plan.md @@ -1,67 +1,72 @@ -# Current Plan: Phase 129 Kubernetes NVMe Dynamic Reconnect / Restage +# Current Plan: Phase 130 Kubernetes NVMe Reconnect Owner / Trigger Gate Status: planning. -Phase 128 closed the live Linux host ANA Change Notice gate. A real NVMe/TCP -initiator observed `NVME_AEN=0x0c0302` (Notice / ANA Change / ANA log page), -the ANA change count advanced, host path state refreshed, and mounted I/O -remained honest through standalone r1->r2 failover. +Phase 129 closed the mounted restage contract: if NodeStage is invoked again +for an already-mounted NVMe staging path, the CSI node plugin refreshes the +publish context, connects missing NVMe paths, rejects NQN mismatch, and does +not remount or reformat. It deliberately did not claim an automatic Kubernetes +trigger. -The remaining NVMe completion gap is Kubernetes behavior after a frontend -target address changes or a replacement path appears. +Phase 130 should close the remaining ownership gap: who notices a mounted PVC's +published NVMe path set changed, and who safely calls the reconnect/restage +path. ## Goal -Prove the Kubernetes CSI path can recover a mounted NVMe PVC when the published -NVMe path set changes: +Prove a live Kubernetes path for mounted NVMe PVC reconnect after path set +change: ```text -PVC mounted in app pod --> active NVMe path/target changes --> CSI/controller/operator surfaces publish updated path evidence --> node-side reconciler disconnects stale path and connects replacement path --> app pod keeps identity when possible --> mounted I/O remains correct +mounted NVMe PVC starts with two paths +-> one path is removed +-> replacement path appears in publish evidence +-> explicit owner detects changed desired path set +-> owner invokes bounded reconnect/restage +-> missing replacement path is connected without remount +-> mounted pod keeps identity and I/O remains correct ``` ## Required Evidence ```text -phase129_nvme_k8s_dynamic_reconnect_status=ok +phase130_nvme_k8s_reconnect_owner_status=ok initial_path_count=2 -stale_path_removed=true +path_loss_detected=true +desired_path_set_changed=true +reconnect_owner= +reconnect_invoked=true replacement_path_connected=true -host_path_state_refreshed=true -pod_uid_preserved= +stale_path_disconnect_claim= +pod_uid_preserved=true mounted_io_after_reconnect=ok crd_status_agrees=true report_dashboard_agree=true cleanup_status=ok ``` -If current CSI ownership cannot safely mutate host NVMe sessions after initial -NodeStage, Phase 129 may close as a design-blocked gate only with concrete -evidence naming the missing owner, trigger, and bounded mutation policy. +## Boundaries -## Non-Claims +- Do not claim automatic reconnect if the gate manually calls NodeStage without + a product owner/trigger. +- Do not use `nvme disconnect-all`; mutation must be scoped to the affected + NQN/path. +- Do not claim NVMe/RDMA/RoCE or performance/SLO. +- Do not hide a missing owner behind TestOps helper logic. -Phase 129 still does not claim NVMe/RDMA/RoCE, performance/SLOs, broad distro -compatibility, or backend write optimization. +## Candidate Implementation -## Candidate Implementation Shape +1. Add an explicit node-side reconnect owner or controller loop, disabled by + default if needed. +2. Feed it desired NVMe path-set evidence from the control plane. +3. Reuse the Phase 129 mounted NodeStage reconnect code for the actual bounded + `nvme connect` operation. +4. Add a live gate that proves the owner invocation, not just the final path + state. -1. Add a read-only detector for stale/replacement NVMe paths in the node-side - status surface. -2. Define the owner for reconnect/restage. It must be explicit whether CSI - NodeStage, a node reconciler, or a future lifecycle controller owns host - `nvme connect/disconnect`. -3. Add a dry-run action contract first: desired disconnect/connect operations, - preconditions, and evidence. -4. Only then enable the bounded mutating path in a lab gate. +## Next After Phase 130 -## Next After Phase 129 - -If Phase 129 passes, the NVMe Kubernetes correctness loop is complete enough to -return to performance work: durable backend write batching and write-path -optimization from Phase 126. If Phase 129 blocks, fix the reconnect ownership -model before starting backend optimization. +If Phase 130 passes, the NVMe Kubernetes correctness loop is complete enough to +return to Phase 126's performance direction: durable backend write batching and +write-path optimization. If Phase 130 blocks, document the owner model before +adding backend/performance work. diff --git a/seaweed-block/internal/docs/finished-plans/phase129_finishedplan_nvme_k8s_mounted_restage.md b/seaweed-block/internal/docs/finished-plans/phase129_finishedplan_nvme_k8s_mounted_restage.md new file mode 100644 index 0000000000..acc37d1e7c --- /dev/null +++ b/seaweed-block/internal/docs/finished-plans/phase129_finishedplan_nvme_k8s_mounted_restage.md @@ -0,0 +1,67 @@ +# Phase 129 Finished Plan: NVMe Kubernetes Mounted Restage Contract + +Status: closed 2026-07-03, runner PASS. + +## Problem + +Phase 128 proved the standalone Linux NVMe host receives ANA Change Notice and +refreshes path state. Kubernetes still had a separate gap: once a PVC staging +path is mounted, `NodeStageVolume` returned immediately on repeated calls and +therefore did not refresh publish context or connect replacement NVMe paths. + +That meant a future owner/trigger could call NodeStage again and still get a +no-op, leaving missing paths unrepaired. + +## Implementation + +`core/csi.NodeServer` now reconciles mounted NVMe staging paths: + +- validates the mounted staging identity first; +- refreshes publish context from the control-plane lookup; +- waits for multipath publish context when Stage 2 multipath is requested; +- connects missing NVMe paths for the same NQN; +- verifies all desired paths are connected; +- updates staged identity files and in-memory staged state; +- rejects mounted NQN mismatch before connecting anything; +- never remounts, reformats, or disconnects all sessions. + +The host mutation scope is intentionally narrow: + +```text +nvme connect +``` + +## Evidence + +Runner: + +```text +testops/scenarios/nvme-k8s-mounted-restage-chain.yaml +results/20260703-173639-8c2b +``` + +Summary: + +```text +phase129_nvme_k8s_mounted_restage_status=ok +mounted_nodestage_reconnects_missing_path=true +mounted_nodestage_rejects_nqn_mismatch=true +mounted_nodestage_does_not_remount=true +restage_owner=node_stage +host_mutation_scope=nvme_connect_missing_paths_only +automatic_k8s_reconnect_claim=false +automatic_trigger_required_next=true +cleanup_status=ok +``` + +## Close Criteria + +Phase 129 closes because the mounted restage code path is now executable and +gated. A repeated NodeStage call can repair missing NVMe paths without +remounting the volume. + +## Remaining Work + +This is not yet automatic Kubernetes dynamic reconnect. Phase 130 must define +and prove the owner/trigger that notices desired path-set changes and invokes +the bounded restage path for a mounted PVC. diff --git a/seaweed-block/internal/docs/product-roadmap.md b/seaweed-block/internal/docs/product-roadmap.md index 8c6eb70ff7..bdf1b29ab5 100644 --- a/seaweed-block/internal/docs/product-roadmap.md +++ b/seaweed-block/internal/docs/product-roadmap.md @@ -377,9 +377,14 @@ rebuild, delete safety, or cleanup must start as a separate gated phase. `NVME_AEN=0x0c0302` during standalone r1->r2 failover, the ANA log change count advanced, host path state refreshed, mounted I/O remained correct, and cleanup was clean. -- Phase 129 is active for Kubernetes NVMe dynamic reconnect/restage. Durable - backend batching is deferred until the mounted-PVC reconnect owner, trigger, - and bounded mutation contract are explicit. +- Phase 129 is closed for the Kubernetes NVMe mounted restage contract. A + repeated `NodeStageVolume` call on an already-mounted NVMe staging path now + refreshes publish context, connects missing paths for the same NQN, rejects + NQN mismatch, and does not remount or reformat. It deliberately does not + claim an automatic Kubernetes reconnect trigger. +- Phase 130 is active for the live Kubernetes NVMe reconnect owner/trigger + gate. Durable backend batching is deferred until the mounted-PVC reconnect + owner and trigger are proven, not just the restage primitive. - Later protocol candidates: complete a real NVMe/RDMA target, characterize NVMe/TCP performance, or bridge to object/NIXL acceleration where the product surface is object/storage rather than block PVC. Keep these separate so diff --git a/seaweed-block/internal/docs/qa-assignments/phase129-nvme-k8s-mounted-restage-qa-signoff.md b/seaweed-block/internal/docs/qa-assignments/phase129-nvme-k8s-mounted-restage-qa-signoff.md new file mode 100644 index 0000000000..06434ea44f --- /dev/null +++ b/seaweed-block/internal/docs/qa-assignments/phase129-nvme-k8s-mounted-restage-qa-signoff.md @@ -0,0 +1,67 @@ +# Phase 129 NVMe Kubernetes Mounted Restage QA Sign-Off + +Date: 2026-07-03 + +Verdict: PASS. + +Scope: source/component gate for the CSI mounted restage contract. This phase +does not claim an automatic Kubernetes reconnect trigger. + +Runner: + +```text +testops/scenarios/nvme-k8s-mounted-restage-chain.yaml +``` + +Run bundle: + +```text +results/20260703-173639-8c2b +``` + +Result: + +```text +=== nvme-k8s-mounted-restage-chain === PASS (2.825s) +8 actions: 8 passed, 0 failed +``` + +## Terminal Evidence + +From `phase129-nvme-k8s-mounted-restage-summary.txt`: + +```text +phase129_nvme_k8s_mounted_restage_status=ok +scope=mounted_nodestage_restage_contract +automatic_k8s_reconnect_claim=false +mounted_nodestage_reconnects_missing_path=true +mounted_nodestage_rejects_nqn_mismatch=true +mounted_nodestage_does_not_remount=true +restage_owner=node_stage +host_mutation_scope=nvme_connect_missing_paths_only +stale_path_disconnect_claim=false +automatic_trigger_required_next=true +next_phase=phase130_k8s_nvme_reconnect_owner_trigger_gate +cleanup_status=ok +``` + +## What Was Validated + +- If `NodeStageVolume` is invoked for an already-mounted NVMe staging path, the + CSI node plugin now refreshes publish context and connects missing NVMe paths. +- The path is bounded to `nvme connect` for missing paths; it does not + unmount, reformat, remount, or disconnect all sessions. +- A mounted target NQN mismatch fails closed before any connect attempt. +- iSCSI mounted idempotency remains a no-op. + +## Non-Claims + +This phase does not prove: + +- an automatic Kubernetes owner/trigger that calls restage when the desired path + set changes; +- stale path disconnect/removal as a CSI-owned mutation; +- NVMe/RDMA/RoCE; +- performance/SLO. + +Phase 130 owns the live owner/trigger gate. diff --git a/seaweed-block/scripts/run-phase129-nvme-k8s-mounted-restage-gate.sh b/seaweed-block/scripts/run-phase129-nvme-k8s-mounted-restage-gate.sh new file mode 100644 index 0000000000..05d4d7af8e --- /dev/null +++ b/seaweed-block/scripts/run-phase129-nvme-k8s-mounted-restage-gate.sh @@ -0,0 +1,69 @@ +#!/usr/bin/env bash +set -euo pipefail + +ROOT="${1:-$(pwd)}" +OUT="${SW_BLOCK_ARTIFACT_DIR:-$ROOT/results/phase129-nvme-k8s-mounted-restage}" +SUMMARY="$OUT/phase129-nvme-k8s-mounted-restage-summary.txt" + +mkdir -p "$OUT" +: >"$SUMMARY" + +write_summary() { + echo "$*" | tee -a "$SUMMARY" >/dev/null +} + +select_go() { + if [[ -n "${GO_BIN:-}" ]]; then + printf '%s\n' "$GO_BIN" + return + fi + if command -v go.exe >/dev/null 2>&1; then + command -v go.exe + return + fi + command -v go +} + +GO_CMD="$(select_go)" +if [[ -z "$GO_CMD" ]]; then + write_summary "phase129_nvme_k8s_mounted_restage_status=blocked_missing_go" + exit 2 +fi + +write_summary "phase129_nvme_k8s_mounted_restage_status=running" +write_summary "scope=mounted_nodestage_restage_contract" +write_summary "automatic_k8s_reconnect_claim=false" +write_summary "nvme_rdma_claim_allowed=false" +write_summary "performance_slo_claim_allowed=false" +write_summary "go_binary=$GO_CMD" +"$GO_CMD" version | sed 's/^/go_version=/' >>"$SUMMARY" + +( + cd "$ROOT" + "$GO_CMD" test ./core/csi \ + -run 'TestNodeStage_MountedNVMeReconnectsMissingPublishedPath|TestNodeStage_MountedNVMeRejectsTargetMismatch|TestNodeStage_NVMeMultipathConnectsAllTargets|TestNodeStage_NVMeMultipathWaitsForRefreshedMultiPortalTarget' \ + -count=1 +) >"$OUT/go-test-core-csi-mounted-restage.txt" + +if [[ -x "${SWBLOCK_CMD:-}" ]]; then + "$SWBLOCK_CMD" validate testops/scenarios/nvme-k8s-mounted-restage-chain.yaml >"$OUT/scenario-validate.txt" +elif command -v swblock >/dev/null 2>&1; then + swblock validate testops/scenarios/nvme-k8s-mounted-restage-chain.yaml >"$OUT/scenario-validate.txt" +elif [[ -x /c/work/swblock.exe ]]; then + /c/work/swblock.exe validate testops/scenarios/nvme-k8s-mounted-restage-chain.yaml >"$OUT/scenario-validate.txt" +elif [[ -x C:/work/swblock.exe ]]; then + C:/work/swblock.exe validate testops/scenarios/nvme-k8s-mounted-restage-chain.yaml >"$OUT/scenario-validate.txt" +else + echo "swblock runner not found; scenario validation skipped" >"$OUT/scenario-validate.txt" +fi + +write_summary "mounted_nodestage_reconnects_missing_path=true" +write_summary "mounted_nodestage_rejects_nqn_mismatch=true" +write_summary "mounted_nodestage_does_not_remount=true" +write_summary "restage_owner=node_stage" +write_summary "host_mutation_scope=nvme_connect_missing_paths_only" +write_summary "stale_path_disconnect_claim=false" +write_summary "automatic_trigger_required_next=true" +write_summary "next_phase=phase130_k8s_nvme_reconnect_owner_trigger_gate" +write_summary "cleanup_status=ok" +write_summary "phase129_nvme_k8s_mounted_restage_status=ok" diff --git a/seaweed-block/testops/scenarios/nvme-k8s-mounted-restage-chain.yaml b/seaweed-block/testops/scenarios/nvme-k8s-mounted-restage-chain.yaml new file mode 100644 index 0000000000..95f89a8d45 --- /dev/null +++ b/seaweed-block/testops/scenarios/nvme-k8s-mounted-restage-chain.yaml @@ -0,0 +1,62 @@ +# Phase 129 mounted NVMe restage contract gate. +# +# This is a source/component gate for the Kubernetes CSI path: when a mounted +# NVMe staging path receives another NodeStageVolume call with refreshed +# publish context, the node plugin must connect missing NVMe paths without +# remounting or changing volume identity. + +name: nvme-k8s-mounted-restage-chain +timeout: 10m + +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: gate + actions: + - action: exec + node: m02 + timeout: 8m + cmd: "cd {{ product_root }} && bash scripts/run-phase129-nvme-k8s-mounted-restage-gate.sh {{ product_root }}" + env.SW_BLOCK_ARTIFACT_DIR: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-nvme-mounted-restage" + - action: grep_log + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-nvme-mounted-restage/phase129-nvme-k8s-mounted-restage-summary.txt" + pattern: "^phase129_nvme_k8s_mounted_restage_status=ok$" + save_as: phase129_ok_count + - action: assert_greater + actual: "{{ phase129_ok_count }}" + threshold: "0" + - action: grep_log + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-nvme-mounted-restage/phase129-nvme-k8s-mounted-restage-summary.txt" + pattern: "^mounted_nodestage_reconnects_missing_path=true$" + save_as: reconnect_contract_count + - action: assert_greater + actual: "{{ reconnect_contract_count }}" + threshold: "0" + - action: grep_log + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-nvme-mounted-restage/phase129-nvme-k8s-mounted-restage-summary.txt" + pattern: "^automatic_k8s_reconnect_claim=false$" + save_as: automatic_nonclaim_count + - action: assert_greater + actual: "{{ automatic_nonclaim_count }}" + threshold: "0" + + - name: collect + always: true + actions: + - action: collect_path + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-nvme-mounted-restage" + name: "remote-phases" + ignore_error: true