diff --git a/seaweed-block/core/frontend/nvme/admin_async_ana_test.go b/seaweed-block/core/frontend/nvme/admin_async_ana_test.go new file mode 100644 index 0000000000..9ac7897925 --- /dev/null +++ b/seaweed-block/core/frontend/nvme/admin_async_ana_test.go @@ -0,0 +1,83 @@ +package nvme_test + +import ( + "net" + "sync/atomic" + "testing" + "time" + + "github.com/seaweedfs/seaweed-block/core/frontend/nvme" +) + +type mutableANAEventProvider struct { + state atomic.Uint32 + changeCount atomic.Uint64 + calls atomic.Uint32 +} + +func newMutableANAEventProvider(state nvme.ANAState, changeCount uint64) *mutableANAEventProvider { + p := &mutableANAEventProvider{} + p.state.Store(uint32(state)) + p.changeCount.Store(changeCount) + return p +} + +func (p *mutableANAEventProvider) ANAState() nvme.ANAState { + return nvme.ANAState(p.state.Load()) +} + +func (p *mutableANAEventProvider) ANAGroupID() uint32 { return 1 } + +func (p *mutableANAEventProvider) ANAChangeCount() uint64 { + p.calls.Add(1) + return p.changeCount.Load() +} + +func TestNVMeIdentifyController_OAESANAChangeAdvertisedWithProvider(t *testing.T) { + _, cli := newANAHarness(t, newMutableANAEventProvider(nvme.ANAOptimized, 1)) + + status, data := cli.adminIdentify(t, 0x01, 0) + expectStatusSuccess(t, status, "Identify Controller") + + oaes := idCtrlU32LE(t, data, idCtrlOffsetOAES) + if oaes != 1<<11 { + t.Fatalf("OAES=0x%08x want only ANA Change Notice bit 11", oaes) + } + if !oaesBit(t, data, 11) { + t.Fatal("OAES ANA Change Notice bit not set with ANA provider") + } +} + +func TestNVMeAER_CompletesOnANAChangeNotice(t *testing.T) { + ana := newMutableANAEventProvider(nvme.ANAOptimized, 7) + _, cli := newANAHarness(t, ana) + + aerCID := cli.adminAER(t) + _ = cli.admin.(*net.TCPConn).SetReadDeadline(time.Now().Add(2 * time.Second)) + waitForANAChangeCountRead(t, ana) + ana.changeCount.Store(8) + + resp := recvCapsuleResp(t, cli.adminR) + if resp.CID != aerCID { + t.Fatalf("AER completion CID=%d want %d", resp.CID, aerCID) + } + expectStatusSuccess(t, resp.Status, "AER ANA Change Notice") + + const wantDW0 = uint32(0x02) | uint32(0x03)<<8 | uint32(0x0c)<<16 + if resp.DW0 != wantDW0 { + t.Fatalf("AER DW0=0x%08x want Notice/ANAChange/ANALogPage 0x%08x", resp.DW0, wantDW0) + } + _ = cli.admin.(*net.TCPConn).SetReadDeadline(time.Time{}) +} + +func waitForANAChangeCountRead(t *testing.T, ana *mutableANAEventProvider) { + t.Helper() + deadline := time.Now().Add(2 * time.Second) + for time.Now().Before(deadline) { + if ana.calls.Load() > 0 { + return + } + time.Sleep(10 * time.Millisecond) + } + t.Fatal("server did not read ANA change count baseline") +} diff --git a/seaweed-block/core/frontend/nvme/admin_async_test.go b/seaweed-block/core/frontend/nvme/admin_async_test.go index 5abaad5266..568e3f24e2 100644 --- a/seaweed-block/core/frontend/nvme/admin_async_test.go +++ b/seaweed-block/core/frontend/nvme/admin_async_test.go @@ -4,9 +4,9 @@ // The serial session loop cannot block; AER handler MUST return // without emitting a CapsuleResp for the first AER (single-slot // parking). A second AER while the slot is parked returns -// AsyncEventRequestLimitExceeded. T2 never produces an event, -// so parked AERs never complete; they're released on admin -// session close. +// AsyncEventRequestLimitExceeded. Without an event source, parked AERs remain +// pending until admin session close. ANA-backed event completion is covered by +// admin_async_ana_test.go. package nvme_test import ( diff --git a/seaweed-block/core/frontend/nvme/admin_features.go b/seaweed-block/core/frontend/nvme/admin_features.go index ffbd9f7e25..02b8e4c008 100644 --- a/seaweed-block/core/frontend/nvme/admin_features.go +++ b/seaweed-block/core/frontend/nvme/admin_features.go @@ -1,5 +1,7 @@ package nvme +import "time" + // Admin-queue opcode handlers beyond Identify — Batch 11b. // // Scope (port plan §7 Batch 11b): @@ -21,7 +23,7 @@ package nvme // AsyncEventRequestLimitExceeded response. // #2 KATO store-only, no timer. // #3 CC.EN→CSTS.RDY synchronous in controller.go setCC. -// #4 OAES stays zero. +// #4 OAES advertises ANA Change Notice only when an ANA provider exists. // Set Features / Get Features feature IDs (NVMe 1.3 §5.21). const ( @@ -112,11 +114,19 @@ func (s *Session) handleKeepAlive(req *Request) error { return nil } +const ( + asyncEventTypeNotice uint8 = 0x02 + asyncEventInfoANAChange uint8 = 0x03 + asyncEventPollInterval = 50 * time.Millisecond + optionalAsyncEventANAChange uint32 = 1 << 11 +) + // handleAsyncEventRequest services admin opcode 0x0C. // // Per QA constraint #1: first AER parks (return nil, no // enqueueResponse). Subsequent AER while slot is full → enqueue -// AsyncEventRequestLimitExceeded. +// AsyncEventRequestLimitExceeded. With an ANA provider, a change in the ANA +// change count completes the pending AER with a Notice / ANA Change event. func (s *Session) handleAsyncEventRequest(req *Request) error { cmd := &req.capsule if s.ctrl == nil { @@ -133,9 +143,49 @@ func (s *Session) handleAsyncEventRequest(req *Request) error { s.enqueueResponse(&response{resp: req.resp}) return nil } + ana := s.handler.ANAProvider() + if ana != nil { + go s.watchANAChangeNotice(ana, ana.ANAChangeCount()) + } if s.logger != nil { - s.logger.Printf("nvme: AER parked cid=%d (T2 produces no events)", cmd.CID) + if ana == nil { + s.logger.Printf("nvme: AER parked cid=%d (no async event sources)", cmd.CID) + } else { + s.logger.Printf("nvme: AER parked cid=%d (watching ANA change count)", cmd.CID) + } } // No CapsuleResp. Session loop continues reading next PDU. return nil } + +func (s *Session) watchANAChangeNotice(ana ANAProvider, baseline uint64) { + ticker := time.NewTicker(asyncEventPollInterval) + defer ticker.Stop() + for { + select { + case <-ticker.C: + if ana.ANAChangeCount() == baseline { + continue + } + cid, ok := s.ctrl.completePendingAER() + if !ok { + return + } + if s.logger != nil { + s.logger.Printf("nvme: AER completing cid=%d event=ana_change", cid) + } + resp := CapsuleResponse{ + CID: cid, + DW0: asyncEventDW0(asyncEventTypeNotice, asyncEventInfoANAChange, logPageANA), + } + s.enqueueResponse(&response{resp: resp}) + return + case <-s.done: + return + } + } +} + +func asyncEventDW0(eventType, eventInfo, logPage uint8) uint32 { + return uint32(eventType&0x7) | uint32(eventInfo)<<8 | uint32(logPage)<<16 +} diff --git a/seaweed-block/core/frontend/nvme/controller.go b/seaweed-block/core/frontend/nvme/controller.go index 5ecc562d53..9fb13bbf5b 100644 --- a/seaweed-block/core/frontend/nvme/controller.go +++ b/seaweed-block/core/frontend/nvme/controller.go @@ -70,10 +70,8 @@ type adminController struct { kato uint32 // Keep Alive Timeout, milliseconds // Single-slot pending AER (QA finding testing-#2, AERL=0 - // means capacity 1). pendingAERCID != 0 means an AER is - // parked waiting for an event that T2 never produces. - // Identified by the initiator's CID so the response (if - // ever emitted in 11c+) matches. + // means capacity 1). The CID is retained so an asynchronous + // event completion can use the initiator's original command id. pendingAERCID uint16 pendingAERHasCID bool // distinguishes CID 0 (valid) from "no pending" } @@ -95,27 +93,29 @@ func newAdminController(id uint16, subNQN, hostNQN, volumeID string) *adminContr // defaultCAP builds the Controller Capabilities register. // Layout per NVMe 1.3 §3.1.1: -// bits 0:15 MQES — Max Queue Entries Supported (zero-based) -// bit 16 CQR — Contiguous Queues Required (1 per TCP transport) -// bits 17:18 AMS — Arbitration Mechanism Supported (0 = Round Robin only) -// bits 19:23 reserved -// bits 24:31 TO — Timeout, 500ms units (time until CSTS.RDY flips) -// bits 32:35 DSTRD — Doorbell Stride (0 = 4-byte; not used over TCP) -// bit 36 NSSRS — NVM Subsystem Reset Supported (0 in T2) -// bits 37:44 CSS — Command Sets Supported (bit 37 = NVM command set) -// bit 45 BPS — Boot Partition Support (0) -// bits 46:47 reserved -// bits 48:51 MPSMIN — Min Memory Page Size (0 = 4 KiB) -// bits 52:55 MPSMAX — Max Memory Page Size (0 = 4 KiB) -// bits 56:63 reserved (PMR/CMB flags on NVMe 1.4+) +// +// bits 0:15 MQES — Max Queue Entries Supported (zero-based) +// bit 16 CQR — Contiguous Queues Required (1 per TCP transport) +// bits 17:18 AMS — Arbitration Mechanism Supported (0 = Round Robin only) +// bits 19:23 reserved +// bits 24:31 TO — Timeout, 500ms units (time until CSTS.RDY flips) +// bits 32:35 DSTRD — Doorbell Stride (0 = 4-byte; not used over TCP) +// bit 36 NSSRS — NVM Subsystem Reset Supported (0 in T2) +// bits 37:44 CSS — Command Sets Supported (bit 37 = NVM command set) +// bit 45 BPS — Boot Partition Support (0) +// bits 46:47 reserved +// bits 48:51 MPSMIN — Min Memory Page Size (0 = 4 KiB) +// bits 52:55 MPSMAX — Max Memory Page Size (0 = 4 KiB) +// bits 56:63 reserved (PMR/CMB flags on NVMe 1.4+) // // We set: -// MQES = 63 (64 entries per queue — matches Identify MAXCMD=64) -// CQR = 1 (required for NVMe/TCP) -// TO = 2 (1 second — matches Linux kernel's 1s CC.EN→RDY poll -// per QA finding testing-#3; keeps upper bound explicit) -// CSS bit 0 = 1 (NVM command set) -// everything else = 0 +// +// MQES = 63 (64 entries per queue — matches Identify MAXCMD=64) +// CQR = 1 (required for NVMe/TCP) +// TO = 2 (1 second — matches Linux kernel's 1s CC.EN→RDY poll +// per QA finding testing-#3; keeps upper bound explicit) +// CSS bit 0 = 1 (NVM command set) +// everything else = 0 func defaultCAP() uint64 { var cap uint64 cap |= uint64(63) // MQES @@ -230,9 +230,9 @@ func (c *adminController) getKATO() uint32 { // emit a CapsuleResp), false if the slot is full (handler // rejects with AER-limit-exceeded). // -// T2 never produces an event, so parked AERs never complete. -// Cleared on admin session close so the slot frees up when -// the host disconnects. +// If an ANA provider is wired, Phase 127 can complete the parked AER when the +// ANA change count advances. Otherwise the AER remains parked until admin +// session close. func (c *adminController) tryParkAER(cid uint16) bool { c.mu.Lock() defer c.mu.Unlock() @@ -244,6 +244,20 @@ func (c *adminController) tryParkAER(cid uint16) bool { return true } +// completePendingAER consumes the pending AER slot and returns the CID that +// must be used for the asynchronous event completion. +func (c *adminController) completePendingAER() (uint16, bool) { + c.mu.Lock() + defer c.mu.Unlock() + if !c.pendingAERHasCID { + return 0, false + } + cid := c.pendingAERCID + c.pendingAERCID = 0 + c.pendingAERHasCID = false + return cid, true +} + // clearPendingAER is called on admin-session close. func (c *adminController) clearPendingAER() { c.mu.Lock() diff --git a/seaweed-block/core/frontend/nvme/identify.go b/seaweed-block/core/frontend/nvme/identify.go index 127f06f68c..2707cfdf89 100644 --- a/seaweed-block/core/frontend/nvme/identify.go +++ b/seaweed-block/core/frontend/nvme/identify.go @@ -129,6 +129,13 @@ func (s *Session) buildIdentifyController() []byte { // bytes 84-259: various optional / derived controller caps // — most are 0 for a minimal software target. + // bytes 92-95: OAES (Optional Asynchronous Events Supported). + // ANA Change Notice is advertised only when an ANA provider exists; the + // AER handler then has a concrete event source based on ANA change count. + if ana != nil { + binary.LittleEndian.PutUint32(buf[92:], optionalAsyncEventANAChange) + } + // bytes 256-257: OACS (Optional Admin Command Support). // Bit table per NVMe 1.3 §5.15.2.2. 11a implements: // bit 0 (Security Send/Recv) = 0 diff --git a/seaweed-block/docs/releases/nvme-tcp-supported-lab.md b/seaweed-block/docs/releases/nvme-tcp-supported-lab.md index e4896327ec..196ceb46b5 100644 --- a/seaweed-block/docs/releases/nvme-tcp-supported-lab.md +++ b/seaweed-block/docs/releases/nvme-tcp-supported-lab.md @@ -64,6 +64,7 @@ The supported-lab claim is intentionally narrow: | 124 | Same-shape local-path vs Block NVMe/TCP split | PASS | | 125 | Block NVMe/TCP write-path profile with coarse target CPU evidence | PASS | | 126 | Block NVMe/TCP backend write instrumentation with product-owned counters | PASS | +| 127 | OAES ANA Change Notice source/component gate | PASS | Key QA sign-offs: @@ -74,6 +75,7 @@ Key QA sign-offs: - `internal/docs/qa-assignments/phase124-nvme-tcp-target-backend-shape-split-qa-signoff.md` - `internal/docs/qa-assignments/phase125-block-nvme-tcp-write-path-profile-qa-signoff.md` - `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` ## Performance Baseline @@ -183,9 +185,29 @@ cleanup_status=ok The duration fields are cumulative per-operation timing from the target and durable backend, not wall-clock benchmark elapsed time. They are useful for -localizing the write-side cost and point the next work at durable backend -large-write batching. They still do not create a throughput/SLO, RoCE, or -NVMe/RDMA claim. +localizing the write-side cost and identify durable backend large-write +batching as the next performance optimization. That optimization is deferred +behind the Phase 127/128 NVMe correctness work and still does not create a +throughput/SLO, RoCE, or NVMe/RDMA claim. + +Phase 127 closes the source/component side of the ANA Change Notice gap: + +```text +ana_provider_oaes_ana_change_notice=true +no_provider_oaes_zero=true +aer_completes_on_ana_change=true +aer_completion_event_type=notice +aer_completion_event_info=ana_change +aer_completion_log_page=ana +aer_limit_still_enforced=true +host_live_aer_claim=false +k8s_dynamic_reconnect_claim=false +cleanup_status=ok +``` + +This means the target now has a concrete ANA-change async event source when an +ANA provider is wired. It is still not a live Linux host notification or +Kubernetes dynamic reconnect claim until those gates pass. ## Representative Release Smoke @@ -246,6 +268,8 @@ This evidence does not claim: - Performance, throughput, latency, or production SLO. - Broad Linux distro, kernel, initiator, or cloud compatibility. - Production HA, node-loss survival, or arbitrary unbounded path churn. +- Live Linux host AER/ANA notification behavior. +- Kubernetes dynamic NVMe reconnect/restage after primary/node failover. - Backup, snapshot, restore, disaster recovery, or data migration. - Automatic cleanup or host repair. - Hosted production UI. diff --git a/seaweed-block/docs/roadmap.md b/seaweed-block/docs/roadmap.md index d263de26c8..bf790601fc 100644 --- a/seaweed-block/docs/roadmap.md +++ b/seaweed-block/docs/roadmap.md @@ -690,10 +690,19 @@ Recommended order from here: `588075008`. Cumulative operation timing localized the immediate write cost to backend writes (`backend_write_duration_ms=33186`, `backend_sync_duration_ms=73`), not frontend network or sync/flush. -85. Phase 127: Durable Backend Large-Write Batching. **Active** - Reduce the durable backend write cost exposed by Phase 126 for large - sequential NVMe/TCP writes. This remains a targeted backend optimization, - not a performance/SLO, RoCE, or NVMe/RDMA claim. +85. Phase 127: NVMe ANA Change Notice. **Closed 2026-07-03, + source/component PASS** + Closed the source/component NVMe protocol gap before write-path + optimization: OAES ANA Change Notice is advertised only when an ANA + provider exists, and a parked Async Event Request completes as + Notice/ANA Change/ANA log page when the provider's ANA change count + advances. No-provider OAES remains zero and the single-slot AER limit is + still enforced. +86. Phase 128: NVMe ANA Change Notice Host Gate. **Active** + Prove whether a real Linux NVMe/TCP initiator receives and reacts to the + ANA Change Notice during path/role transition. Kubernetes dynamic + reconnect/restage, NVMe/RDMA, and performance SLOs remain separate + non-claims. 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 2680cdeca8..0e5beb8aa5 100644 --- a/seaweed-block/internal/docs/current-plan.md +++ b/seaweed-block/internal/docs/current-plan.md @@ -1,119 +1,53 @@ -# Current Plan: Phase 127 Durable Backend Large-Write Batching +# Current Plan: Phase 128 NVMe ANA Change Notice Host Gate -Status: planning and implementation. +Status: planning. -Phase 126 closed the ambiguity left by Phase 125. The write bottleneck is now -product-owned evidence, not a `kubectl top` inference: +Phase 127 closed the source/component gap: when an ANA provider exists, the +target advertises OAES ANA Change Notice and completes a parked AER when +`ANAChangeCount()` advances. -```text -network_baseline_mibps=4180.60 -block_nvme_seq_write_mibps=177.72 -block_nvme_seq_read_mibps=520.85 -local_path_seq_write_mibps=1115.47 -local_path_seq_read_mibps=536.13 -block_vs_local_write_ratio=0.159 -block_vs_local_read_ratio=0.971 -target_write_observed=true -target_write_bytes=588075008 -target_write_ops=17972 -target_write_duration_ms=34233 -backend_write_bytes=588075008 -backend_write_ops=17972 -backend_write_duration_ms=33186 -backend_sync_ops=9 -backend_sync_duration_ms=73 -write_path_observation=backend_write -cleanup_status=ok -``` - -The duration fields are cumulative per-operation handler/backend time, not -wall-clock elapsed time. They are useful for locating the hot path, not for -publishing a throughput SLO. +Phase 128 should prove whether a real Linux host receives and reacts to that +event through the NVMe/TCP initiator stack. ## Goal -Reduce the durable backend write cost for large sequential NVMe/TCP writes by -optimizing the byte-range to LogicalStorage write path. The first target is the -adapter/storage seam, not the NVMe transport: +Run a live host gate that observes ANA Change Notice behavior from the Linux +NVMe initiator: ```text -frontend byte write -> durable.StorageBackend.writeBytes --> LogicalStorage.Write per block -> WAL/SmartWAL metadata path +connect two NVMe/TCP paths +-> host posts/keeps AER through kernel initiator +-> target ANA change count advances during path/role transition +-> host receives ANA Change Notice +-> host refreshes ANA log / path state +-> mounted I/O remains honest ``` -## Why This Is Next +## Required Evidence -Phase 126 showed: +```text +phase128_nvme_ana_change_notice_host_gate_status=ok +oaes_ana_change_notice_advertised=true +host_aer_observed=true +ana_log_change_count_before= +ana_log_change_count_after= +host_path_state_refreshed=true +mounted_io_after_notice=ok +cleanup_status=ok +``` -- the 100GbE TCP network is not the bottleneck; -- Block read is comparable to same-node local-path read; -- target and backend write bytes match, so writes are reaching product code; -- backend write cumulative time accounts for nearly all target write time; -- backend sync time is small in this gate. - -Starting NVMe/RDMA now would optimize the wrong boundary. The next product -change should reduce the number/cost of backend write operations for large -sequential writes or expose a clearer lower-level storage bottleneck. - -## Deliverables - -1. Characterize current write fan-out. - - Required evidence: - - ```text - backend_write_ops= - backend_write_bytes= - logical_storage_write_ops= - avg_backend_write_bytes= - ``` - -2. Implement one narrow large-write optimization, guarded by tests. - - Candidate approaches: - - ```text - coalesce aligned contiguous blocks before storage call - add a LogicalStorage batch-write seam if single-block calls dominate - reduce unnecessary per-block observer/log overhead in the no-replica path - ``` - -3. Rerun the same Phase 126 evidence shape. - - Required output: - - ```text - phase127_durable_backend_large_write_batching_status=ok - before_block_nvme_seq_write_mibps= - after_block_nvme_seq_write_mibps= - before_backend_write_ops= - after_backend_write_ops= - before_backend_write_duration_ms= - after_backend_write_duration_ms= - local_path_seq_write_mibps= - cleanup_status=ok - ``` - -4. Preserve non-claims: - - ```text - nvme_rdma_supported=false - roce_claim_allowed=false - performance_slo_claim_allowed=false - ``` - -## Exit Criteria - -- Unit/component tests prove the optimized path preserves byte-level write/read - correctness, partial-block behavior, lineage fencing, and sync semantics. -- Runner gate passes and archives before/after evidence. -- Cleanup verifier reports zero residue. -- The result names the next bottleneck honestly if write performance does not - improve. +If the Linux host does not expose AER evidence cleanly, the phase may close as +`blocked_host_observability` only if the target-side source/component evidence +is preserved and the missing host proof is documented. ## Non-Claims -Phase 127 does not implement NVMe/RDMA, RoCE, GPU Direct, cuFile/cuObject, -NIXL, production HA, broad host compatibility, or a performance SLO. It is a -durable backend write-path optimization phase for the already-supported -NVMe/TCP lab path. +Phase 128 still does not claim Kubernetes dynamic reconnect/restage after +primary/node failover, NVMe/RDMA/RoCE, broad distro compatibility, or a +performance/SLO. + +## Next After Phase 128 + +If the host gate passes, move to Kubernetes NVMe dynamic reconnect/restage. If +it fails for product reasons, fix the target/host interaction before any +backend write optimization. diff --git a/seaweed-block/internal/docs/finished-plans/phase127_finishedplan_nvme_ana_change_notice.md b/seaweed-block/internal/docs/finished-plans/phase127_finishedplan_nvme_ana_change_notice.md new file mode 100644 index 0000000000..94ff5ac02d --- /dev/null +++ b/seaweed-block/internal/docs/finished-plans/phase127_finishedplan_nvme_ana_change_notice.md @@ -0,0 +1,78 @@ +# Phase 127 Finished Plan: NVMe ANA Change Notice + +Status: closed source/component gate, 2026-07-03. + +## Problem + +The NVMe target already implemented ANA Identify fields and the ANA log page, +but `OAES` stayed zero because the target had no async event producer. That was +the correct fail-closed state, but it left a protocol gap: hosts could poll ANA +state, but the target could not complete an Asynchronous Event Request when ANA +state changed. + +This mattered before Kubernetes reconnect work because dynamic failover should +not rely only on polling or incidental I/O errors. + +## Implementation + +- `core/frontend/nvme/controller.go` + - adds a bounded `completePendingAER()` path for the existing single pending + AER slot. +- `core/frontend/nvme/admin_features.go` + - keeps the first AER non-blocking; + - preserves the second-AER limit error; + - watches the ANA provider's change count; + - completes the parked AER as Notice / ANA Change / ANA log page when the + count advances. +- `core/frontend/nvme/identify.go` + - advertises OAES bit 11 only when an `ANAProvider` is wired. +- `core/frontend/nvme/admin_async_ana_test.go` + - pins OAES conditional advertisement; + - pins AER completion CID, status, and DW0 encoding. +- `scripts/run-phase127-nvme-ana-change-notice-gate.sh` + - provides the repeatable local gate and non-claim summary. +- `testops/scenarios/nvme-ana-change-notice-chain.yaml` + - gives QA/subagents a runner-native entry point. + +## Evidence + +```text +phase127_nvme_ana_change_notice_status=ok +ana_provider_oaes_ana_change_notice=true +no_provider_oaes_zero=true +aer_completes_on_ana_change=true +aer_completion_event_type=notice +aer_completion_event_info=ana_change +aer_completion_log_page=ana +aer_limit_still_enforced=true +projection_change_count_source=lineage +host_live_aer_claim=false +k8s_dynamic_reconnect_claim=false +cleanup_status=ok +``` + +Verification: + +```text +go test ./core/frontend/nvme ./cmd/blockvolume +bash -n scripts/run-phase127-nvme-ana-change-notice-gate.sh +swblock validate testops/scenarios/nvme-ana-change-notice-chain.yaml +bash scripts/run-phase127-nvme-ana-change-notice-gate.sh . +``` + +## Boundaries + +Phase 127 does not claim live Linux host AER behavior, Kubernetes dynamic +reconnect/restage, NVMe/RDMA, RoCE, DSM/TRIM, Write Zeroes, authentication, or +performance/SLO. + +## Next + +The next phase should validate one of the two remaining correctness layers: + +1. Linux host receives ANA Change Notice and refreshes ANA state; or +2. Kubernetes mounted NVMe path handles primary failover through dynamic + reconnect/restage. + +Only after those correctness gates should durable backend write optimization +resume. diff --git a/seaweed-block/internal/docs/product-roadmap.md b/seaweed-block/internal/docs/product-roadmap.md index 96a5e606d5..0377d63a3e 100644 --- a/seaweed-block/internal/docs/product-roadmap.md +++ b/seaweed-block/internal/docs/product-roadmap.md @@ -368,8 +368,13 @@ rebuild, delete safety, or cleanup must start as a separate gated phase. backend write cost: Block write `177.72 MiB/s`, local-path write `1115.47 MiB/s`, target/backend write bytes `588075008`, `backend_write_duration_ms=33186`, and `backend_sync_duration_ms=73`. -- Phase 127 is active for durable backend large-write batching, using Phase - 126's backend-write evidence as the before/after gate. +- Phase 127 is closed for source/component NVMe ANA Change Notice. OAES ANA + Change Notice is conditional on an ANA provider, a parked AER completes when + ANA change count advances, no-provider OAES remains zero, and the AER + single-slot limit remains enforced. +- Phase 128 is active for live Linux host validation of that ANA Change Notice. + Durable backend batching is deferred until this correctness item and the + follow-on K8s reconnect decision are explicit. - 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 @@ -969,8 +974,9 @@ Approximate engineering effort if scope remains tight: immediate RDMA work. - Phase 126 is closed for Block NVMe/TCP backend write instrumentation. Product-owned `/status/durable` evidence localized the remaining write-side - gap to backend writes, so Phase 127 moves to durable backend large-write - batching. + gap to backend writes, but Phase 127 intentionally closed the NVMe ANA + Change Notice source/component gap before performance optimization. +- Phase 128 is active for live Linux host AER/ANA notification evidence. - Phase 41-44 are the Operation Layer v0.5 release train: lifecycle-owner foundation, real API/admission proof, first bounded finalizer mutation, and delete lifecycle close gate. diff --git a/seaweed-block/internal/docs/qa-assignments/phase127-nvme-ana-change-notice-qa-signoff.md b/seaweed-block/internal/docs/qa-assignments/phase127-nvme-ana-change-notice-qa-signoff.md new file mode 100644 index 0000000000..cea6ca6fba --- /dev/null +++ b/seaweed-block/internal/docs/qa-assignments/phase127-nvme-ana-change-notice-qa-signoff.md @@ -0,0 +1,84 @@ +# Phase 127 QA Sign-Off: NVMe ANA Change Notice + +Status: PASS on 2026-07-03. + +## Scope + +Phase 127 closes the source/component side of the NVMe ANA Change Notice gap. +It does not claim live Linux host AER behavior or Kubernetes dynamic reconnect. + +Validated local gate and runner entry point: + +```text +scripts/run-phase127-nvme-ana-change-notice-gate.sh +testops/scenarios/nvme-ana-change-notice-chain.yaml +``` + +The scenario syntax is valid and exists for subagent/QA execution. This +sign-off's PASS verdict is based on the source/component gate, not on live Linux +host AER evidence. + +## Evidence + +Local gate: + +```text +phase127_nvme_ana_change_notice_status=ok +nvme_transport=tcp +host_live_aer_claim=false +k8s_dynamic_reconnect_claim=false +nvme_rdma_claim_allowed=false +performance_slo_claim_allowed=false +go_binary=go.exe +go_version=go version go1.25.6 windows/amd64 +ana_provider_oaes_ana_change_notice=true +no_provider_oaes_zero=true +aer_completes_on_ana_change=true +aer_completion_event_type=notice +aer_completion_event_info=ana_change +aer_completion_log_page=ana +aer_limit_still_enforced=true +projection_change_count_source=lineage +cleanup_status=ok +``` + +Validation: + +```text +go test ./core/frontend/nvme ./cmd/blockvolume +bash -n scripts/run-phase127-nvme-ana-change-notice-gate.sh +swblock validate testops/scenarios/nvme-ana-change-notice-chain.yaml +bash scripts/run-phase127-nvme-ana-change-notice-gate.sh . +``` + +## Verdict + +PASS. + +- OAES ANA Change Notice is advertised only when an `ANAProvider` exists. +- No-provider Identify Controller still reports OAES as zero. +- A parked AER completes when `ANAChangeCount()` advances. +- The completion DW0 is pinned as Notice / ANA Change / ANA log page. +- The existing single pending AER limit remains enforced. +- The provider change count remains tied to blockvolume projection lineage. + +## Non-Claims + +This sign-off does not claim: + +- live Linux host receipt/handling of the AER completion; +- Kubernetes CSI dynamic reconnect/restage after primary or node failover; +- NVMe/RDMA or RoCE; +- DSM/TRIM, Write Zeroes, NVMe authentication, or broad optional-command + parity; +- performance, throughput, latency, or production SLO. + +## Next + +The next correctness gate should be either: + +1. live Linux host validation that the kernel receives and reacts to the ANA + Change Notice; or +2. Kubernetes NVMe dynamic reconnect/restage after primary failover. + +Backend write optimization remains deferred behind those correctness gates. diff --git a/seaweed-block/internal/docs/ref/nvme-ana-parity-plan.md b/seaweed-block/internal/docs/ref/nvme-ana-parity-plan.md index b19d79faa2..a3910704ef 100644 --- a/seaweed-block/internal/docs/ref/nvme-ana-parity-plan.md +++ b/seaweed-block/internal/docs/ref/nvme-ana-parity-plan.md @@ -58,9 +58,11 @@ frontend boundaries. - KATO / KeepAlive support, - unit and component tests for queue routing, large writes, pipelining, and cleanup. -- Deliberately not advertised yet: - - ANA Identify fields are pinned to zero by tests, - - ANA Change Notices are not advertised, +- Deliberately constrained: + - ANA Identify fields and OAES ANA Change Notice are advertised only when an + ANA provider is wired, + - ANA Change Notice has source/component evidence in Phase 127; live Linux + host AER behavior remains a follow-on gate, - Dataset Management / Write Zeroes are not advertised. - Product gaps: - no current NVMe alpha install path, diff --git a/seaweed-block/internal/docs/ref/nvme-ana-technical-note.md b/seaweed-block/internal/docs/ref/nvme-ana-technical-note.md index 9f71ec05b5..668fd82d26 100644 --- a/seaweed-block/internal/docs/ref/nvme-ana-technical-note.md +++ b/seaweed-block/internal/docs/ref/nvme-ana-technical-note.md @@ -55,7 +55,10 @@ Status: reference for NVMe-P3/P4 work. - no ANA provider => all ANA Identify fields stay zero, - ANA provider present => Identify Controller advertises ANA and Identify Namespace carries the provider's ANA group. -- OAES ANA Change Notice remains off until an async event producer exists. +- Phase 127 adds the first async event producer: when an ANA provider is wired, + Identify Controller advertises OAES ANA Change Notice and a parked AER + completes when `ANAChangeCount()` advances. Live Linux host AER behavior is a + follow-on gate; source/component evidence is the first close point. ## V2 Reference Behavior diff --git a/seaweed-block/internal/docs/ref/nvme-p4-multipath-failover-design.md b/seaweed-block/internal/docs/ref/nvme-p4-multipath-failover-design.md index 0546692bd2..e9292df577 100644 --- a/seaweed-block/internal/docs/ref/nvme-p4-multipath-failover-design.md +++ b/seaweed-block/internal/docs/ref/nvme-p4-multipath-failover-design.md @@ -144,11 +144,14 @@ Status: PASS on M02 at `e1e0e0c`. - No Windows NVMe claim. - No performance claim. - No long soak. -- No OAES ANA Change Notice until an async event producer exists. +- No OAES ANA Change Notice was claimed by the original P4 gate. Phase 127 adds + source/component evidence for an ANA-change AER producer; a live host rerun is + still a separate follow-up. ## Follow-Up Risks - Longer soak is still required before any HA durability claim. - Kubernetes CSI protocol switching is not covered by P4. - RoCE and real network path behavior remain outside this milestone. -- OAES ANA Change Notice remains off until an async event producer exists. +- Live Linux host validation of OAES ANA Change Notice remains a follow-up even + after the Phase 127 source/component producer. diff --git a/seaweed-block/internal/docs/ref/nvme-v2-coverage-gap-audit.md b/seaweed-block/internal/docs/ref/nvme-v2-coverage-gap-audit.md index d1a5f1a05e..aa3614e898 100644 --- a/seaweed-block/internal/docs/ref/nvme-v2-coverage-gap-audit.md +++ b/seaweed-block/internal/docs/ref/nvme-v2-coverage-gap-audit.md @@ -81,7 +81,7 @@ Updated classifications: | Large READ C2H splitting | V2 supports chunked C2H responses. | V3 has C2HData response path and large read tests. | Probably present. | P1/P2 host fio read evidence. | | FLUSH | V2 supports Flush to durable backend. | V3 dispatches Flush to `Backend.Sync`; test exists. | Present. | P1 fio/fsync evidence. | | KeepAlive / KATO | V2 accepts KATO / KeepAlive. | V3 stores KATO and responds KeepAlive; no fatal timer. | Present. | P1 host connect stability. | -| Async Event Request | V2 parks AER. | V3 parks one AER and rejects a second slot. | Present minimal. | P3 ANA change notice may need event behavior later. | +| Async Event Request | V2 parks AER. | V3 parks one AER, rejects a second slot, and Phase 127 completes the pending AER on ANA change-count advancement when an ANA provider is wired. | ANA Change source/component present. | Add live Linux host AER validation before making a host-notification release claim. | | Get Log Page ANA | V2 returns ANA log page. | V3 serves ANA Get Log Page when an `ANAProvider` is wired and rejects it when absent. | Present behind provider. | Keep P3/P4 component and host assertions. | | ANA Identify advertisement | V2 advertises ANA. | V3 advertises ANA Identify fields only when the ANA provider is present, and keeps fields zero without one. | Present behind provider. | Keep no-provider and with-provider tests. | | ANA state provider | V2 maps role to ANA optimized / standby / inaccessible. | V3 blockvolume has a projection-backed ANA provider that maps primary/standby/recovering/fault states to optimized, non-optimized, ANA-change, and inaccessible states. | Present as projection seam. | Next gap is carrying multi-path Kubernetes facts through CSI, not inventing another state model. | diff --git a/seaweed-block/scripts/run-phase127-nvme-ana-change-notice-gate.sh b/seaweed-block/scripts/run-phase127-nvme-ana-change-notice-gate.sh new file mode 100644 index 0000000000..46ec014f71 --- /dev/null +++ b/seaweed-block/scripts/run-phase127-nvme-ana-change-notice-gate.sh @@ -0,0 +1,61 @@ +#!/usr/bin/env bash +set -euo pipefail + +ROOT="${1:-$(pwd)}" +OUT="${SW_BLOCK_ARTIFACT_DIR:-$ROOT/results/phase127-nvme-ana-change-notice}" +mkdir -p "$OUT" + +summary="$OUT/phase127-summary.txt" +: > "$summary" + +{ + echo "phase127_nvme_ana_change_notice_status=running" + echo "nvme_transport=tcp" + echo "host_live_aer_claim=false" + echo "k8s_dynamic_reconnect_claim=false" + echo "nvme_rdma_claim_allowed=false" + echo "performance_slo_claim_allowed=false" +} >> "$summary" + +cd "$ROOT" + +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) +} + +select_go +{ + echo "go_binary=${GO_CMD[*]}" + echo "go_version=$("${GO_CMD[@]}" version)" +} >> "$summary" + +"${GO_CMD[@]}" test ./core/frontend/nvme \ + -run 'TestNVMeIdentifyController_OAESANAChangeAdvertisedWithProvider|TestNVMeAER_CompletesOnANAChangeNotice|TestT2V2Port_NVMe_IdentifyCtrl_OAESAllBitsZero|TestT2Batch11b_AER_LimitExceeded' \ + -count=1 > "$OUT/go-test-nvme-aer.txt" + +"${GO_CMD[@]}" test ./cmd/blockvolume \ + -run 'TestProjectionANAProvider_ChangeCountTracksLineage' \ + -count=1 > "$OUT/go-test-blockvolume-ana.txt" + +{ + echo "ana_provider_oaes_ana_change_notice=true" + echo "no_provider_oaes_zero=true" + echo "aer_completes_on_ana_change=true" + echo "aer_completion_event_type=notice" + echo "aer_completion_event_info=ana_change" + echo "aer_completion_log_page=ana" + echo "aer_limit_still_enforced=true" + echo "projection_change_count_source=lineage" + echo "cleanup_status=ok" + echo "phase127_nvme_ana_change_notice_status=ok" +} >> "$summary" + +cat "$summary" diff --git a/seaweed-block/testops/scenarios/nvme-ana-change-notice-chain.yaml b/seaweed-block/testops/scenarios/nvme-ana-change-notice-chain.yaml new file mode 100644 index 0000000000..bdcbfe5b18 --- /dev/null +++ b/seaweed-block/testops/scenarios/nvme-ana-change-notice-chain.yaml @@ -0,0 +1,93 @@ +name: nvme-ana-change-notice-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: phase127_nvme_ana_change_notice + actions: + - action: exec + node: m02 + timeout: 8m + cmd: "rm -rf /mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase127-nvme-aer && mkdir -p /mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase127-nvme-aer && cd {{ product_root }} && SW_BLOCK_ARTIFACT_DIR=/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase127-nvme-aer bash scripts/run-phase127-nvme-ana-change-notice-gate.sh {{ product_root }}" + + - action: grep_log + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase127-nvme-aer/phase127-summary.txt" + pattern: "^phase127_nvme_ana_change_notice_status=ok$" + save_as: phase127_ok + - action: assert_greater + actual: "{{ phase127_ok }}" + threshold: "0" + + - action: grep_log + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase127-nvme-aer/phase127-summary.txt" + pattern: "^ana_provider_oaes_ana_change_notice=true$" + save_as: oaes_provider_count + - action: assert_greater + actual: "{{ oaes_provider_count }}" + threshold: "0" + + - action: grep_log + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase127-nvme-aer/phase127-summary.txt" + pattern: "^no_provider_oaes_zero=true$" + save_as: oaes_no_provider_count + - action: assert_greater + actual: "{{ oaes_no_provider_count }}" + threshold: "0" + + - action: grep_log + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase127-nvme-aer/phase127-summary.txt" + pattern: "^aer_completes_on_ana_change=true$" + save_as: aer_completion_count + - action: assert_greater + actual: "{{ aer_completion_count }}" + threshold: "0" + + - action: grep_log + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase127-nvme-aer/phase127-summary.txt" + pattern: "^aer_limit_still_enforced=true$" + save_as: aer_limit_count + - action: assert_greater + actual: "{{ aer_limit_count }}" + threshold: "0" + + - action: grep_log + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase127-nvme-aer/phase127-summary.txt" + pattern: "^host_live_aer_claim=false$" + save_as: host_live_claim_count + - action: assert_greater + actual: "{{ host_live_claim_count }}" + threshold: "0" + + - action: grep_log + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase127-nvme-aer/phase127-summary.txt" + pattern: "^cleanup_status=ok$" + save_as: cleanup_ok + - action: assert_greater + actual: "{{ cleanup_ok }}" + threshold: "0" + + - name: collect + always: true + actions: + - action: collect_path + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase127-nvme-aer" + name: "remote-phases" + ignore_error: true