testops: add beta hardening gates and storage readiness evidence

Adds the beta-hardening test and operations foundation for Seaweed Block, including runner-native protocol/beta gates, CSI lifecycle and durable restart coverage, iSCSI/NVMe protocol release gates, returned-replica evidence, read-only operations status reports, OS initiator compatibility gates, and fast iSCSI L2 durable restart/reconnect coverage.
This commit is contained in:
Ping Qiu authored and GitHub committed 2026-05-11 10:38:00 -07:00
1 parent 6dd9dc33e2
commit dfa31007a1
78 files changed
+8247 -985

No files matched your search

@@ -81,6 +81,117 @@ func TestG15d_BlockmasterLauncherTickWritesBlockvolumeManifest(t *testing.T) {
}
}
func TestG15d_BlockmasterLauncherTickCanRenderHostPathState(t *testing.T) {
h, err := master.New(master.Config{
AuthorityStoreDir: t.TempDir(),
LifecycleStoreDir: t.TempDir(),
Listen: "127.0.0.1:0",
})
if err != nil {
t.Fatalf("master.New: %v", err)
}
h.Start()
defer func() { _ = h.Close(context.Background()) }()
stores := h.Lifecycle()
if _, err := stores.Volumes.CreateVolume(lifecycle.VolumeSpec{
VolumeID: "pvc-a",
SizeBytes: 1 << 20,
ReplicationFactor: 1,
}); err != nil {
t.Fatalf("create volume: %v", err)
}
if _, err := stores.Nodes.RegisterNode(lifecycle.NodeRegistration{
ServerID: "m02",
DataAddr: "10.0.0.2:9201",
CtrlAddr: "10.0.0.2:9101",
Pools: []lifecycle.StoragePool{{
PoolID: "default",
TotalBytes: 1 << 30,
FreeBytes: 1 << 30,
BlockSize: 4096,
}},
}); err != nil {
t.Fatalf("register node: %v", err)
}
if _, err := h.RunLifecycleProductTick(); err != nil {
t.Fatalf("product tick: %v", err)
}
outDir := t.TempDir()
if err := runLifecycleLauncherTick(h, flags{
launcherManifestDir: outDir,
launcherNamespace: "kube-system",
launcherImage: "sw-block:test",
launcherMasterAddr: "blockmaster.kube-system.svc.cluster.local:9333",
launcherDurableRoot: "/var/lib/sw-block",
launcherStateHostPath: "/var/lib/sw-block",
launcherISCSIPortBase: 3260,
}); err != nil {
t.Fatalf("launcher tick: %v", err)
}
raw, err := os.ReadFile(filepath.Join(outDir, "sw-blockvolume-pvc-a-r1.yaml"))
if err != nil {
t.Fatalf("read manifest: %v", err)
}
body := string(raw)
stateSection := yamlStateVolumeSection(t, body)
for _, want := range []string{
"hostPath:",
"path: /var/lib/sw-block",
"type: DirectoryOrCreate",
} {
if !strings.Contains(stateSection, want) {
t.Fatalf("state volume missing %q:\n%s", want, stateSection)
}
}
if strings.Contains(stateSection, "emptyDir:") {
t.Fatalf("hostPath state volume must not render emptyDir:\n%s", stateSection)
}
}
func yamlStateVolumeSection(t *testing.T, body string) string {
t.Helper()
lines := strings.Split(body, "\n")
volumesIndent := -1
stateStart := -1
stateIndent := -1
for i, line := range lines {
trimmed := strings.TrimSpace(line)
indent := len(line) - len(strings.TrimLeft(line, " "))
if volumesIndent < 0 {
if trimmed == "volumes:" {
volumesIndent = indent
}
continue
}
if indent <= volumesIndent && trimmed != "" {
break
}
if trimmed == "- name: state" {
stateStart = i
stateIndent = indent
break
}
}
if stateStart < 0 {
t.Fatalf("state volume section not found:\n%s", body)
}
stateEnd := len(lines)
for i := stateStart + 1; i < len(lines); i++ {
trimmed := strings.TrimSpace(lines[i])
indent := len(lines[i]) - len(strings.TrimLeft(lines[i], " "))
if indent == stateIndent && strings.HasPrefix(trimmed, "- name:") {
stateEnd = i
break
}
if indent < stateIndent && trimmed != "" {
stateEnd = i
break
}
}
return strings.Join(lines[stateStart:stateEnd], "\n")
}
func TestG15d_BlockmasterLauncherTickRendersNVMeManifestFromLifecycleProtocol(t *testing.T) {
h, err := master.New(master.Config{
AuthorityStoreDir: t.TempDir(),
+6
View File
@@ -36,9 +36,11 @@ type flags struct {
launcherImage string
launcherMasterAddr string
launcherDurableRoot string
launcherStateHostPath string
launcherISCSIPortBase int
launcherNVMePortBase int
launcherPVCOwnerRef bool
launcherStatus bool
launcherCHAPSecretName string
launcherCHAPUserKey string
launcherCHAPSecretKey string
@@ -69,9 +71,11 @@ func parseFlags(args []string) (flags, error) {
fs.StringVar(&f.launcherImage, "launcher-image", "sw-block:local", "G15d rendered blockvolume container image")
fs.StringVar(&f.launcherMasterAddr, "launcher-master-addr", "", "G15d master address used in rendered blockvolume args; defaults to listener address after bind")
fs.StringVar(&f.launcherDurableRoot, "launcher-durable-root", "/var/lib/sw-block", "G15d rendered blockvolume durable root base")
fs.StringVar(&f.launcherStateHostPath, "launcher-state-hostpath", "", "optional hostPath base mounted at the blockvolume durable root; empty keeps generated blockvolume state on throwaway emptyDir")
fs.IntVar(&f.launcherISCSIPortBase, "launcher-iscsi-port-base", 3260, "G15d iSCSI port base for generated blockvolume workloads")
fs.IntVar(&f.launcherNVMePortBase, "launcher-nvme-port-base", 4420, "G15d NVMe/TCP port base for generated blockvolume workloads")
fs.BoolVar(&f.launcherPVCOwnerRef, "launcher-pvc-owner-ref", false, "render generated blockvolume Deployments in the source PVC namespace with a PVC ownerReference; disabled by default for alpha harness compatibility")
fs.BoolVar(&f.launcherStatus, "launcher-status", false, "render loopback-only blockvolume status endpoints in generated workload manifests; intended for TestOps/diagnostics")
fs.StringVar(&f.launcherCHAPSecretName, "launcher-iscsi-chap-secret-name", "", "optional Kubernetes Secret name used by generated blockvolume Deployments for target-side iSCSI CHAP")
fs.StringVar(&f.launcherCHAPUserKey, "launcher-iscsi-chap-username-key", "chapUsername", "Kubernetes Secret key for generated blockvolume iSCSI CHAP username")
fs.StringVar(&f.launcherCHAPSecretKey, "launcher-iscsi-chap-secret-key", "chapSecret", "Kubernetes Secret key for generated blockvolume iSCSI CHAP secret")
@@ -305,7 +309,9 @@ func runLifecycleLauncherTick(h *master.Host, f flags) error {
Image: f.launcherImage,
MasterAddr: masterAddr,
DurableRootBase: f.launcherDurableRoot,
StateHostPathBase: f.launcherStateHostPath,
OwnerReferenceToPVC: f.launcherPVCOwnerRef,
EnableStatus: f.launcherStatus,
ISCSICHAP: launcher.CHAPSecretRef{
Name: f.launcherCHAPSecretName,
UsernameKey: f.launcherCHAPUserKey,
@@ -103,6 +103,14 @@ func (c *g8IscsiClient) read10(t *testing.T, lba uint32, blocks uint16, bytesPer
return data
}
func (c *g8IscsiClient) syncCache10(t *testing.T) {
t.Helper()
status, _ := c.scsi(t, g8SyncCacheCDB10(), nil, 0)
if status != iscsi.StatusGood {
t.Fatalf("iSCSI SYNCHRONIZE CACHE(10) status=0x%02x", status)
}
}
func (c *g8IscsiClient) scsi(t *testing.T, cdb [16]byte, writePayload []byte, expectedDataIn int) (uint8, []byte) {
t.Helper()
req := &iscsi.PDU{}
@@ -163,3 +171,9 @@ func g8ReadCDB10(lba uint32, blocks uint16) [16]byte {
binary.BigEndian.PutUint16(cdb[7:9], blocks)
return cdb
}
func g8SyncCacheCDB10() [16]byte {
var cdb [16]byte
cdb[0] = iscsi.ScsiSyncCache10
return cdb
}
@@ -0,0 +1,348 @@
//go:build subprocess
package main_test
import (
"bufio"
"bytes"
"encoding/json"
"fmt"
"io"
"net"
"os"
"os/exec"
"path/filepath"
"testing"
"time"
)
func TestISCSI_L2DurableRestartReconnect_PreservesData(t *testing.T) {
if testing.Short() {
t.Skip("L2 subprocess durable restart test; -short skip")
}
bins := buildG54Binaries(t)
art := t.TempDir()
_, masterAddr := startSingleSlotMaster(t, bins, art)
iqn := "iqn.2026-05.example.restart:v1"
store := filepath.Join(art, "r1-store")
dataAddr, ctrlAddr := pickAddr(t), pickAddr(t)
statusAddr, iscsiAddr := pickAddr(t), pickAddr(t)
r1 := startG54Volume(t, bins, art, volOpts{
masterAddr: masterAddr,
serverID: "s1",
replicaID: "r1",
dataAddr: dataAddr,
ctrlAddr: ctrlAddr,
statusAddr: statusAddr,
iscsiAddr: iscsiAddr,
iscsiIQN: iqn,
durableRoot: store,
logTag: "iscsi-restart-r1-initial",
})
waitHealthyReplica(t, statusAddr, "r1", 10*time.Second)
waitProductIscsiReady(t, iscsiAddr, 5*time.Second)
const durableBlockSize = 4096
payload := bytes.Repeat([]byte{0x6d}, durableBlockSize)
copy(payload, []byte("iscsi-durable-restart-reconnect-payload"))
c1 := dialG8Iscsi(t, iscsiAddr, iqn)
c1.write10(t, 11, payload)
c1.close(t)
r1.stop(t)
time.Sleep(500 * time.Millisecond)
r1Restart := startG54Volume(t, bins, art, volOpts{
masterAddr: masterAddr,
serverID: "s1",
replicaID: "r1",
dataAddr: dataAddr,
ctrlAddr: ctrlAddr,
statusAddr: statusAddr,
iscsiAddr: iscsiAddr,
iscsiIQN: iqn,
durableRoot: store,
logTag: "iscsi-restart-r1-restarted",
})
_ = r1Restart
waitHealthyReplica(t, statusAddr, "r1", 10*time.Second)
waitProductIscsiReady(t, iscsiAddr, 5*time.Second)
c2 := dialG8Iscsi(t, iscsiAddr, iqn)
got := c2.read10(t, 11, 1, durableBlockSize)
c2.close(t)
if !bytes.Equal(got, payload) {
t.Fatalf("read after blockvolume durable restart mismatch: got prefix=%x want prefix=%x", bytePrefix(got, 32), bytePrefix(payload, 32))
}
}
func TestISCSI_L2DurableRestartReconnect_RepeatedCycles(t *testing.T) {
if testing.Short() {
t.Skip("L2 subprocess durable restart cycle test; -short skip")
}
bins := buildG54Binaries(t)
art := t.TempDir()
_, masterAddr := startSingleSlotMaster(t, bins, art)
iqn := "iqn.2026-05.example.restart-cycles:v1"
store := filepath.Join(art, "r1-store")
dataAddr, ctrlAddr := pickAddr(t), pickAddr(t)
statusAddr, iscsiAddr := pickAddr(t), pickAddr(t)
var r1 *proc
start := func(tag string) {
t.Helper()
r1 = startG54Volume(t, bins, art, volOpts{
masterAddr: masterAddr,
serverID: "s1",
replicaID: "r1",
dataAddr: dataAddr,
ctrlAddr: ctrlAddr,
statusAddr: statusAddr,
iscsiAddr: iscsiAddr,
iscsiIQN: iqn,
durableRoot: store,
logTag: tag,
})
waitHealthyReplica(t, statusAddr, "r1", 10*time.Second)
waitProductIscsiReady(t, iscsiAddr, 5*time.Second)
}
stop := func() {
t.Helper()
r1.stop(t)
time.Sleep(500 * time.Millisecond)
}
start("iscsi-restart-cycle-0")
const durableBlockSize = 4096
writes := make(map[uint32][]byte)
for cycle := 0; cycle < 3; cycle++ {
lba := uint32(20 + cycle)
payload := bytes.Repeat([]byte{byte(0x70 + cycle)}, durableBlockSize)
copy(payload, []byte("iscsi-durable-restart-repeated-cycle"))
payload[len(payload)-1] = byte(cycle)
cli := dialG8Iscsi(t, iscsiAddr, iqn)
cli.write10(t, lba, payload)
for priorLBA, want := range writes {
got := cli.read10(t, priorLBA, 1, durableBlockSize)
if !bytes.Equal(got, want) {
cli.close(t)
t.Fatalf("cycle %d prior LBA %d mismatch: got prefix=%x want prefix=%x", cycle, priorLBA, bytePrefix(got, 32), bytePrefix(want, 32))
}
}
cli.close(t)
writes[lba] = payload
stop()
start(fmt.Sprintf("iscsi-restart-cycle-%d", cycle+1))
}
cli := dialG8Iscsi(t, iscsiAddr, iqn)
defer cli.close(t)
for lba, want := range writes {
got := cli.read10(t, lba, 1, durableBlockSize)
if !bytes.Equal(got, want) {
t.Fatalf("final LBA %d mismatch: got prefix=%x want prefix=%x", lba, bytePrefix(got, 32), bytePrefix(want, 32))
}
}
}
func TestISCSI_L2DurableSyncCacheRestart_AcceptsSyncAndPreservesWrites(t *testing.T) {
if testing.Short() {
t.Skip("L2 subprocess durable sync-cache restart test; -short skip")
}
bins := buildG54Binaries(t)
art := t.TempDir()
_, masterAddr := startSingleSlotMaster(t, bins, art)
iqn := "iqn.2026-05.example.sync-restart:v1"
store := filepath.Join(art, "r1-store")
dataAddr, ctrlAddr := pickAddr(t), pickAddr(t)
statusAddr, iscsiAddr := pickAddr(t), pickAddr(t)
r1 := startG54Volume(t, bins, art, volOpts{
masterAddr: masterAddr,
serverID: "s1",
replicaID: "r1",
dataAddr: dataAddr,
ctrlAddr: ctrlAddr,
statusAddr: statusAddr,
iscsiAddr: iscsiAddr,
iscsiIQN: iqn,
durableRoot: store,
logTag: "iscsi-sync-restart-r1-initial",
})
waitHealthyReplica(t, statusAddr, "r1", 10*time.Second)
waitProductIscsiReady(t, iscsiAddr, 5*time.Second)
const durableBlockSize = 4096
expected := make(map[uint32][]byte)
cli := dialG8Iscsi(t, iscsiAddr, iqn)
for i := 0; i < 12; i++ {
lba := uint32(40 + i)
payload := bytes.Repeat([]byte{byte(0x30 + i)}, durableBlockSize)
copy(payload, []byte("iscsi-durable-sync-cache-restart-payload"))
payload[len(payload)-1] = byte(i)
cli.write10(t, lba, payload)
expected[lba] = payload
if (i+1)%4 == 0 {
cli.syncCache10(t)
}
}
cli.syncCache10(t)
cli.close(t)
r1.stop(t)
time.Sleep(500 * time.Millisecond)
_ = startG54Volume(t, bins, art, volOpts{
masterAddr: masterAddr,
serverID: "s1",
replicaID: "r1",
dataAddr: dataAddr,
ctrlAddr: ctrlAddr,
statusAddr: statusAddr,
iscsiAddr: iscsiAddr,
iscsiIQN: iqn,
durableRoot: store,
logTag: "iscsi-sync-restart-r1-restarted",
})
waitHealthyReplica(t, statusAddr, "r1", 10*time.Second)
waitProductIscsiReady(t, iscsiAddr, 5*time.Second)
cli2 := dialG8Iscsi(t, iscsiAddr, iqn)
defer cli2.close(t)
for lba, want := range expected {
got := cli2.read10(t, lba, 1, durableBlockSize)
if !bytes.Equal(got, want) {
t.Fatalf("synced LBA %d mismatch after restart: got prefix=%x want prefix=%x", lba, bytePrefix(got, 32), bytePrefix(want, 32))
}
}
}
func startSingleSlotMaster(t *testing.T, bins l2bins, art string) (*proc, string) {
t.Helper()
storeDir := filepath.Join(art, "master-store")
if err := os.MkdirAll(storeDir, 0o755); err != nil {
t.Fatalf("master store dir %s: %v", storeDir, err)
}
topo := writeSingleSlotTopology(t, art)
logPath := filepath.Join(art, "master-single-slot.log")
lf, err := os.Create(logPath)
if err != nil {
t.Fatalf("master log: %v", err)
}
cmd := exec.Command(bins.master,
"--authority-store", storeDir,
"--listen", "127.0.0.1:0",
"--topology", topo,
"--expected-slots-per-volume", "1",
"--freshness-window", "800ms",
"--pending-grace", "100ms",
"--t0-print-ready",
)
stdout, err := cmd.StdoutPipe()
if err != nil {
lf.Close()
t.Fatalf("master stdout pipe: %v", err)
}
cmd.Stderr = lf
if err := cmd.Start(); err != nil {
lf.Close()
t.Fatalf("master start: %v", err)
}
p := &proc{cmd: cmd, logPath: logPath}
t.Cleanup(func() { p.stop(t); lf.Close() })
br := bufio.NewReader(stdout)
type readyResult struct {
line []byte
err error
}
readyCh := make(chan readyResult, 1)
go func() {
line, err := br.ReadBytes('\n')
readyCh <- readyResult{line: line, err: err}
}()
var ready readyResult
select {
case ready = <-readyCh:
case <-time.After(5 * time.Second):
t.Fatalf("master ready line timeout")
}
if ready.err != nil {
t.Fatalf("master ready line: %v", ready.err)
}
go func() { _, _ = io.Copy(io.Discard, br) }()
var rl struct {
Component, Phase, Addr string
}
if err := json.Unmarshal(ready.line, &rl); err != nil {
t.Fatalf("parse master ready %q: %v", ready.line, err)
}
if rl.Addr == "" {
t.Fatalf("master ready: empty addr (line=%q)", ready.line)
}
return p, rl.Addr
}
func writeSingleSlotTopology(t *testing.T, dir string) string {
t.Helper()
path := filepath.Join(dir, "topology-single-slot.yaml")
body := `volumes:
- volume_id: v1
slots:
- replica_id: r1
server_id: s1
`
if err := os.WriteFile(path, []byte(body), 0o644); err != nil {
t.Fatalf("single-slot topology: %v", err)
}
return path
}
func waitHealthyReplica(t *testing.T, statusAddr, replicaID string, deadline time.Duration) map[string]any {
t.Helper()
got := pollStatus(t, statusAddr, deadline, func(b map[string]any) bool {
h, _ := b["Healthy"].(bool)
rid, _ := b["ReplicaID"].(string)
return h && rid == replicaID
})
if got == nil {
t.Fatalf("%s: no Healthy status within %s", replicaID, deadline)
}
if h, _ := got["Healthy"].(bool); !h {
t.Fatalf("%s: Healthy=true expected; got status=%v", replicaID, got)
}
return got
}
func waitProductIscsiReady(t *testing.T, iscsiAddr string, deadline time.Duration) {
t.Helper()
end := time.Now().Add(deadline)
var lastErr error
for time.Now().Before(end) {
conn, err := net.DialTimeout("tcp", iscsiAddr, 200*time.Millisecond)
if err == nil {
_ = conn.Close()
return
}
lastErr = err
time.Sleep(100 * time.Millisecond)
}
t.Fatalf("iSCSI listener %s not reachable within %s: last error: %v", iscsiAddr, deadline, lastErr)
}
func bytePrefix(b []byte, n int) []byte {
if len(b) < n {
return b
}
return b[:n]
}
+6
View File
@@ -428,6 +428,9 @@ func run(f flags) int {
}
durableProv = dp
provider = dp
if status != nil {
status.SetDurableStatusSource(dp)
}
// Open storage role-agnostically via EnsureStorage so replica
// roles (assigned to SUPPORTING, never reach Healthy via
@@ -498,6 +501,9 @@ func run(f flags) int {
return 1
}
replVolume = replication.NewReplicationVolume(f.volumeID, store)
if status != nil {
status.SetPeerStatusSource(replVolume)
}
repMode, writeAck, err := parseReplicationAckProfile(f.replicationAck)
if err != nil {
fmt.Fprintln(os.Stderr, "blockvolume:", err)
+10 -1
View File
@@ -203,6 +203,8 @@ func volumeSpecFromCreateRequest(req *csipb.CreateVolumeRequest) (VolumeSpec, er
}
func protocolFromParameters(params map[string]string) (Protocol, error) {
protocol := Protocol("")
source := ""
for _, key := range []string{
storageClassProtocolParameter,
"protocol",
@@ -214,11 +216,18 @@ func protocolFromParameters(params map[string]string) (Protocol, error) {
}
switch Protocol(raw) {
case ProtocolISCSI, ProtocolNVMe:
return Protocol(raw), nil
if protocol != "" && protocol != Protocol(raw) {
return "", status.Errorf(codes.InvalidArgument, "conflicting protocol parameters %q=%q and %q=%q", source, protocol, key, raw)
}
protocol = Protocol(raw)
source = key
default:
return "", status.Errorf(codes.InvalidArgument, "invalid protocol %q", raw)
}
}
if protocol != "" {
return protocol, nil
}
return ProtocolISCSI, nil
}
+76 -17
View File
@@ -261,7 +261,7 @@ func TestG15c_ControllerCreateVolume_RecordsProtocolSelection(t *testing.T) {
{name: "product-prefixed", params: map[string]string{storageClassProtocolParameter: "nvme"}},
{name: "legacy-protocol", params: map[string]string{"protocol": "nvme"}},
{name: "frontendProtocol", params: map[string]string{"frontendProtocol": "nvme"}},
{name: "prefixed-wins", params: map[string]string{storageClassProtocolParameter: "nvme", "protocol": "iscsi"}},
{name: "matching-duplicate-keys", params: map[string]string{storageClassProtocolParameter: "nvme", "protocol": "nvme"}},
} {
t.Run(tc.name, func(t *testing.T) {
prov := &stubProvisioner{}
@@ -293,26 +293,85 @@ func TestG15c_ControllerCreateVolume_RecordsProtocolSelection(t *testing.T) {
}
}
func TestG15c_ControllerCreateVolume_RejectsInvalidProtocol(t *testing.T) {
s := NewControllerServerWithProvisioner(&stubLookup{}, &stubProvisioner{})
_, err := s.CreateVolume(context.Background(), &csipb.CreateVolumeRequest{
Name: "pvc-a",
CapacityRange: &csipb.CapacityRange{
RequiredBytes: 1 << 30,
func TestG15c_ControllerCreateVolume_RejectsConflictingProtocolParameters(t *testing.T) {
for _, tc := range []struct {
name string
params map[string]string
}{
{
name: "product-prefixed-vs-legacy",
params: map[string]string{
storageClassProtocolParameter: "nvme",
"protocol": "iscsi",
},
},
Parameters: map[string]string{
"protocol": "nfs",
{
name: "product-prefixed-vs-frontendProtocol",
params: map[string]string{
storageClassProtocolParameter: "iscsi",
"frontendProtocol": "nvme",
},
},
VolumeCapabilities: []*csipb.VolumeCapability{
testVolumeCapability(),
{
name: "legacy-vs-frontendProtocol",
params: map[string]string{
"protocol": "nvme",
"frontendProtocol": "iscsi",
},
},
})
if err == nil {
t.Fatal("expected invalid protocol error")
} {
t.Run(tc.name, func(t *testing.T) {
s := NewControllerServerWithProvisioner(&stubLookup{}, &stubProvisioner{})
_, err := s.CreateVolume(context.Background(), &csipb.CreateVolumeRequest{
Name: "pvc-a",
CapacityRange: &csipb.CapacityRange{
RequiredBytes: 1 << 30,
},
Parameters: tc.params,
VolumeCapabilities: []*csipb.VolumeCapability{
testVolumeCapability(),
},
})
if err == nil {
t.Fatal("expected conflicting protocol parameters to fail")
}
st, _ := status.FromError(err)
if st.Code() != codes.InvalidArgument {
t.Fatalf("code=%v want InvalidArgument", st.Code())
}
})
}
st, _ := status.FromError(err)
if st.Code() != codes.InvalidArgument {
t.Fatalf("code=%v want InvalidArgument", st.Code())
}
func TestG15c_ControllerCreateVolume_RejectsInvalidProtocol(t *testing.T) {
for _, tc := range []struct {
name string
params map[string]string
}{
{name: "legacy", params: map[string]string{"protocol": "nfs"}},
{name: "product-prefixed", params: map[string]string{storageClassProtocolParameter: "nfs"}},
{name: "frontendProtocol", params: map[string]string{"frontendProtocol": "nfs"}},
} {
t.Run(tc.name, func(t *testing.T) {
s := NewControllerServerWithProvisioner(&stubLookup{}, &stubProvisioner{})
_, err := s.CreateVolume(context.Background(), &csipb.CreateVolumeRequest{
Name: "pvc-a",
CapacityRange: &csipb.CapacityRange{
RequiredBytes: 1 << 30,
},
Parameters: tc.params,
VolumeCapabilities: []*csipb.VolumeCapability{
testVolumeCapability(),
},
})
if err == nil {
t.Fatal("expected invalid protocol error")
}
st, _ := status.FromError(err)
if st.Code() != codes.InvalidArgument {
t.Fatalf("code=%v want InvalidArgument", st.Code())
}
})
}
}
+26
View File
@@ -378,6 +378,9 @@ func (s *NodeServer) NodePublishVolume(ctx context.Context, req *csipb.NodePubli
if s.mountUtil == nil {
return nil, status.Error(codes.FailedPrecondition, "mount utility is not configured")
}
if err := s.validatePublishStagingVolume(volumeID, stagingPath); err != nil {
return nil, err
}
mounted, err := s.mountUtil.IsMounted(ctx, targetPath)
if err != nil {
return nil, status.Errorf(codes.Internal, "check mount: %v", err)
@@ -509,6 +512,29 @@ func (s *NodeServer) validateMountedStagingVolume(volumeID, stagingPath string)
return status.Errorf(codes.FailedPrecondition, "staging path %q is already mounted without sw-block volume identity", stagingPath)
}
func (s *NodeServer) validatePublishStagingVolume(volumeID, stagingPath string) error {
s.stagedMu.Lock()
info := s.staged[volumeID]
if info != nil && info.stagingPath == stagingPath {
s.stagedMu.Unlock()
return nil
}
for otherVolume, otherInfo := range s.staged {
if otherVolume != volumeID && otherInfo != nil && otherInfo.stagingPath == stagingPath {
s.stagedMu.Unlock()
return status.Errorf(codes.FailedPrecondition, "staging path %q belongs to volume %q", stagingPath, otherVolume)
}
}
s.stagedMu.Unlock()
if got := readVolumeFile(stagingPath); got == volumeID {
return nil
} else if got != "" {
return status.Errorf(codes.FailedPrecondition, "staging path %q belongs to volume %q", stagingPath, got)
}
return status.Errorf(codes.FailedPrecondition, "staging path %q has no sw-block volume identity", stagingPath)
}
func (s *NodeServer) hasStagedIdentity(volumeID, stagingPath string) bool {
s.stagedMu.Lock()
info := s.staged[volumeID]
+177
View File
@@ -776,6 +776,127 @@ func TestNodeStageUnstage_RepeatedCyclesLeaveNoLocalState(t *testing.T) {
}
}
func TestG15e_CSIReattachUsesFreshPublishTargetAfterUnstage(t *testing.T) {
mi, mm := newMockISCSIUtil(), newMockMountUtil()
ns := newTestNode(mi, mm)
lookup := &stubLookup{target: PublishTarget{
VolumeID: "v1",
ReplicaID: "r1",
Protocol: ProtocolISCSI,
ISCSIAddr: "127.0.0.1:3260",
IQN: "iqn.2026-05.example.v3:v1-old",
}}
controller := NewControllerServer(lookup)
staging := t.TempDir()
target1 := filepath.Join(t.TempDir(), "pod-a")
target2 := filepath.Join(t.TempDir(), "pod-b")
firstPublish, err := controller.ControllerPublishVolume(context.Background(), &csipb.ControllerPublishVolumeRequest{
VolumeId: "v1",
NodeId: "node-a",
})
if err != nil {
t.Fatalf("first ControllerPublishVolume: %v", err)
}
if _, err := ns.NodeStageVolume(context.Background(), &csipb.NodeStageVolumeRequest{
VolumeId: "v1",
StagingTargetPath: staging,
VolumeCapability: testVolumeCapability(),
PublishContext: firstPublish.GetPublishContext(),
}); err != nil {
t.Fatalf("first NodeStageVolume: %v", err)
}
if _, err := ns.NodePublishVolume(context.Background(), &csipb.NodePublishVolumeRequest{
VolumeId: "v1",
StagingTargetPath: staging,
TargetPath: target1,
}); err != nil {
t.Fatalf("first NodePublishVolume: %v", err)
}
if _, err := ns.NodeUnpublishVolume(context.Background(), &csipb.NodeUnpublishVolumeRequest{
VolumeId: "v1",
TargetPath: target1,
}); err != nil {
t.Fatalf("NodeUnpublishVolume: %v", err)
}
if _, err := controller.ControllerUnpublishVolume(context.Background(), &csipb.ControllerUnpublishVolumeRequest{
VolumeId: "v1",
NodeId: "node-a",
}); err != nil {
t.Fatalf("ControllerUnpublishVolume: %v", err)
}
if _, err := ns.NodeUnstageVolume(context.Background(), &csipb.NodeUnstageVolumeRequest{
VolumeId: "v1",
StagingTargetPath: staging,
}); err != nil {
t.Fatalf("NodeUnstageVolume: %v", err)
}
if mi.loggedIn["iqn.2026-05.example.v3:v1-old"] {
t.Fatalf("old IQN still logged in after unstage")
}
if ns.staged["v1"] != nil {
t.Fatalf("unstage left staged state: %+v", ns.staged["v1"])
}
lookup.target = PublishTarget{
VolumeID: "v1",
ReplicaID: "r1",
Protocol: ProtocolISCSI,
ISCSIAddr: "127.0.0.2:3260",
IQN: "iqn.2026-05.example.v3:v1-new",
}
secondPublish, err := controller.ControllerPublishVolume(context.Background(), &csipb.ControllerPublishVolumeRequest{
VolumeId: "v1",
NodeId: "node-a",
})
if err != nil {
t.Fatalf("second ControllerPublishVolume: %v", err)
}
if got := secondPublish.GetPublishContext()["iqn"]; got != "iqn.2026-05.example.v3:v1-new" {
t.Fatalf("second publish_context iqn=%q", got)
}
if _, err := ns.NodeStageVolume(context.Background(), &csipb.NodeStageVolumeRequest{
VolumeId: "v1",
StagingTargetPath: staging,
VolumeCapability: testVolumeCapability(),
PublishContext: secondPublish.GetPublishContext(),
}); err != nil {
t.Fatalf("second NodeStageVolume: %v", err)
}
if _, err := ns.NodePublishVolume(context.Background(), &csipb.NodePublishVolumeRequest{
VolumeId: "v1",
StagingTargetPath: staging,
TargetPath: target2,
}); err != nil {
t.Fatalf("second NodePublishVolume: %v", err)
}
if !mi.loggedIn["iqn.2026-05.example.v3:v1-new"] {
t.Fatalf("fresh IQN was not logged in after reattach; loggedIn=%v", mi.loggedIn)
}
if got := readTargetFile(staging); got != "iqn.2026-05.example.v3:v1-new" {
t.Fatalf("target file=%q want fresh IQN", got)
}
if len(lookup.calls) != 2 {
t.Fatalf("ControllerPublish should be called once per attach cycle, calls=%v", lookup.calls)
}
for _, want := range []string{
"logout:iqn.2026-05.example.v3:v1-old",
"discovery:127.0.0.2:3260",
"login:iqn.2026-05.example.v3:v1-new:127.0.0.2:3260",
} {
found := false
for _, call := range mi.calls {
if call == want {
found = true
break
}
}
if !found {
t.Fatalf("missing call %q in %v", want, mi.calls)
}
}
}
func TestTransportFileRejectsGarbage(t *testing.T) {
staging := t.TempDir()
if err := writeTransportFile(staging, "nvme\n"); err != nil {
@@ -791,6 +912,9 @@ func TestNodePublish_BindMountsAndIsIdempotent(t *testing.T) {
ns := newTestNode(mi, mm)
staging := t.TempDir()
target := filepath.Join(t.TempDir(), "pod-target")
if err := writeVolumeFile(staging, "v1"); err != nil {
t.Fatal(err)
}
_, err := ns.NodePublishVolume(context.Background(), &csipb.NodePublishVolumeRequest{
VolumeId: "v1",
@@ -817,6 +941,59 @@ func TestNodePublish_BindMountsAndIsIdempotent(t *testing.T) {
}
}
func TestNodePublish_FailsClosedWithoutStagingIdentity(t *testing.T) {
mi, mm := newMockISCSIUtil(), newMockMountUtil()
ns := newTestNode(mi, mm)
staging := t.TempDir()
target := filepath.Join(t.TempDir(), "pod-target")
_, err := ns.NodePublishVolume(context.Background(), &csipb.NodePublishVolumeRequest{
VolumeId: "v1",
StagingTargetPath: staging,
TargetPath: target,
})
if err == nil {
t.Fatal("expected missing staging identity to fail")
}
st, _ := status.FromError(err)
if st.Code() != codes.FailedPrecondition {
t.Fatalf("code=%v want FailedPrecondition", st.Code())
}
for _, call := range mm.calls {
if strings.HasPrefix(call, "bindmount:") {
t.Fatalf("must fail before bind mount, calls=%v", mm.calls)
}
}
}
func TestNodePublish_FailsClosedWhenStagingPathBelongsToAnotherVolume(t *testing.T) {
mi, mm := newMockISCSIUtil(), newMockMountUtil()
ns := newTestNode(mi, mm)
staging := t.TempDir()
target := filepath.Join(t.TempDir(), "pod-target")
if err := writeVolumeFile(staging, "v2"); err != nil {
t.Fatal(err)
}
_, err := ns.NodePublishVolume(context.Background(), &csipb.NodePublishVolumeRequest{
VolumeId: "v1",
StagingTargetPath: staging,
TargetPath: target,
})
if err == nil {
t.Fatal("expected wrong staging identity to fail")
}
st, _ := status.FromError(err)
if st.Code() != codes.FailedPrecondition {
t.Fatalf("code=%v want FailedPrecondition", st.Code())
}
for _, call := range mm.calls {
if strings.HasPrefix(call, "bindmount:") {
t.Fatalf("must fail before bind mount, calls=%v", mm.calls)
}
}
}
func TestNodeStage_NoPublishTargetFailsClosed(t *testing.T) {
ns := newTestNode(newMockISCSIUtil(), newMockMountUtil())
_, err := ns.NodeStageVolume(context.Background(), &csipb.NodeStageVolumeRequest{
@@ -32,6 +32,7 @@ import (
"log"
"os"
"path/filepath"
"sort"
"sync"
"time"
@@ -114,6 +115,22 @@ type volHandle struct {
path string
}
// VolumeStatus is a read-only diagnostic snapshot of one durable volume
// handle. It intentionally exposes lineage and readiness facts without giving
// callers a control surface.
type VolumeStatus struct {
VolumeID string
Path string
Impl string
ReplicaID string
Epoch uint64
EndpointVersion uint64
Latched bool
Operational bool
Evidence string
Closed bool
}
// NewDurableProvider constructs a provider. view is the ONLY
// source of authority lineage the provider is allowed to consult
// (sketch §9 boundary).
@@ -291,6 +308,28 @@ func (p *DurableProvider) Backend(volumeID string) *StorageBackend {
return h.backend
}
// DurableStatuses returns stable, sorted diagnostic snapshots for all opened
// volume handles. This is used by status endpoints and TestOps gates to prove
// durable lineage latching without scraping logs.
func (p *DurableProvider) DurableStatuses() []VolumeStatus {
p.mu.Lock()
handles := make(map[string]*volHandle, len(p.volumes))
for volumeID, h := range p.volumes {
handles[volumeID] = h
}
impl := string(p.cfg.Impl)
p.mu.Unlock()
out := make([]VolumeStatus, 0, len(handles))
for volumeID, h := range handles {
out = append(out, h.backend.durableStatus(volumeID, h.path, impl))
}
sort.Slice(out, func(i, j int) bool {
return out[i].VolumeID < out[j].VolumeID
})
return out
}
// waitHealthy polls the projection until it reports Healthy for
// volumeID, or ctx / cfg.OpenTimeout expires.
func (p *DurableProvider) waitHealthy(ctx context.Context, volumeID string) error {
@@ -273,3 +273,49 @@ func TestDurableProvider_EnsureStorage_ConcurrentSameVolumeReturnsSingleHandle(t
})
}
}
func TestDurableProvider_DurableStatuses_ReportLineageAndOperationalState(t *testing.T) {
for _, impl := range implMatrix() {
impl := impl
t.Run(string(impl), func(t *testing.T) {
p, _, root := newProvider(t, impl)
if _, err := p.Open(context.Background(), "v1"); err != nil {
t.Fatalf("Open: %v", err)
}
before := p.DurableStatuses()
if len(before) != 1 {
t.Fatalf("status count before recover=%d want 1: %+v", len(before), before)
}
if before[0].VolumeID != "v1" || before[0].ReplicaID != "r1" || before[0].Epoch != 1 || before[0].EndpointVersion != 1 {
t.Fatalf("unexpected lineage before recover: %+v", before[0])
}
if !before[0].Latched {
t.Fatalf("status should report latched lineage after Open: %+v", before[0])
}
if before[0].Operational {
t.Fatalf("status should not be operational before RecoverVolume: %+v", before[0])
}
if before[0].Impl != string(impl) {
t.Fatalf("impl=%q want %q", before[0].Impl, impl)
}
if before[0].Path != filepath.Join(root, "v1.bin") {
t.Fatalf("path=%q want %q", before[0].Path, filepath.Join(root, "v1.bin"))
}
if _, err := p.RecoverVolume(context.Background(), "v1"); err != nil {
t.Fatalf("RecoverVolume: %v", err)
}
after := p.DurableStatuses()
if len(after) != 1 {
t.Fatalf("status count after recover=%d want 1: %+v", len(after), after)
}
if !after[0].Operational || !after[0].Latched {
t.Fatalf("status should report recovered durable lineage: %+v", after[0])
}
if after[0].Evidence == "" {
t.Fatalf("status should include recovery evidence: %+v", after[0])
}
})
}
}
@@ -219,6 +219,26 @@ func (b *StorageBackend) SetIdentity(id frontend.Identity) bool {
return true
}
func (b *StorageBackend) durableStatus(volumeID, path, impl string) VolumeStatus {
b.mu.Lock()
id := b.id
closed := b.closed
b.mu.Unlock()
evidence, _ := b.opEvidence.Load().(string)
return VolumeStatus{
VolumeID: volumeID,
Path: path,
Impl: impl,
ReplicaID: id.ReplicaID,
Epoch: id.Epoch,
EndpointVersion: id.EndpointVersion,
Latched: id.Epoch > 0 && id.EndpointVersion > 0,
Operational: b.operational.Load(),
Evidence: evidence,
Closed: closed,
}
}
// Close marks the backend closed. All subsequent I/O + Sync
// return ErrBackendClosed. Does NOT close the underlying
// storage — the Provider owns LogicalStorage lifecycle.
@@ -87,3 +87,39 @@ func TestG8A_StaleSupersedeFact_DoesNotFenceCurrentPrimaryBackend(t *testing.T)
t.Fatalf("current primary write after stale supersede: n=%d err=%v", n, err)
}
}
func TestG8A_ReturnedSupportingReplica_DoesNotServeFrontendBackend(t *testing.T) {
proj := &mutableProjector{p: engine.ReplicaProjection{
Mode: engine.ModeHealthy, Epoch: 2, EndpointVersion: 1,
}}
h := &Host{cfg: Config{VolumeID: "v1", ReplicaID: "r1"}}
h.view = NewAdapterProjectionView(proj, "v1", "r1", h)
id := frontend.Identity{VolumeID: "v1", ReplicaID: "r1", Epoch: 2, EndpointVersion: 1}
store := memorywal.NewStore(8, 4096)
t.Cleanup(func() { _ = store.Close() })
backend := durable.NewStorageBackend(store, h.view, id)
backend.SetOperational(true, "g8 returned supporting baseline")
// Same lineage as this replica, but authority names r2. This is the
// recovered/supporting replica shape: safe for replication consumers,
// never safe for frontend writes.
h.recordOtherLine(&control.AssignmentFact{
VolumeId: "v1",
ReplicaId: "r2",
Epoch: 2,
EndpointVersion: 1,
DataAddr: "r2-data",
CtrlAddr: "r2-ctrl",
})
if p := h.view.Projection(); p.Healthy {
t.Fatalf("supporting returned replica projection must fail closed for frontend: %+v", p)
}
if _, err := backend.Write(context.Background(), 0, []byte("must-not-write")); !errors.Is(err, frontend.ErrStalePrimary) {
t.Fatalf("supporting returned replica write: got %v want ErrStalePrimary", err)
}
if _, err := backend.Read(context.Background(), 0, make([]byte, 4)); !errors.Is(err, frontend.ErrStalePrimary) {
t.Fatalf("supporting returned replica read: got %v want ErrStalePrimary", err)
}
}
@@ -31,7 +31,7 @@ func TestG9C_StatusProjection_DualLaneRecoveredReplicaReadyAfterPostCloseAck(t *
h.view = NewAdapterProjectionView(a, "v1", "replica-0", h)
// The current frontend authority line names another replica at the
// same lineage. This process can become a supporting replica_ready,
// but must never report frontend-primary-ready.
// but must never report frontend-primary-ready or frontend Healthy.
h.recordOtherLine(&control.AssignmentFact{
VolumeId: "v1",
ReplicaId: "primary-r1",
@@ -73,8 +73,8 @@ func TestG9C_StatusProjection_DualLaneRecoveredReplicaReadyAfterPostCloseAck(t *
ready := waitG9CStatus(t, addr, 5*time.Second, func(p StatusProjection) bool {
return p.ReplicationRole == ReplicationRoleReady && !p.FrontendPrimaryReady
})
if !ready.Healthy {
t.Fatalf("replica_ready should expose Healthy=true for support consumers: %+v", ready)
if ready.Healthy {
t.Fatalf("replica_ready must remain frontend-unhealthy for support-only consumers: %+v", ready)
}
})
}
@@ -3,6 +3,7 @@ package volume
import (
"github.com/seaweedfs/seaweed-block/core/engine"
"github.com/seaweedfs/seaweed-block/core/frontend"
control "github.com/seaweedfs/seaweed-block/core/rpc/control"
)
// adapterProjector is the narrow seam this bridge needs. Keeps
@@ -51,11 +52,18 @@ type SupersedeProbe interface {
// Healthy rule (fail-closed):
//
// Healthy = (engine.Mode == ModeHealthy) AND NOT superseded
// AND NOT supporting-replica-ready
//
// If the engine is locally Healthy but master has named another
// replica as primary at a newer lineage, Healthy flips to false.
// This closes the cross-replica authority-move gap architect
// review flagged on 2026-04-21.
//
// If the engine is locally Healthy and master has named another
// replica as primary at the SAME lineage, this replica may be a
// recovered supporting replica, but it still must not serve frontend
// I/O. Status surfaces that as replication_role=replica_ready; the
// frontend projection fails closed by reporting Healthy=false.
type AdapterProjectionView struct {
projector adapterProjector
volumeID string
@@ -90,7 +98,7 @@ func (v *AdapterProjectionView) projectionWithSupersede() (frontend.Projection,
p := v.projector.Projection()
healthy := p.Mode == engine.ModeHealthy
superseded := healthy && v.probe != nil && v.probe.IsSuperseded(v.replicaID, p.Epoch, p.EndpointVersion)
if superseded {
if superseded || (healthy && v.supportingReplicaReady(p.Epoch, p.EndpointVersion)) {
healthy = false
}
return frontend.Projection{
@@ -102,6 +110,25 @@ func (v *AdapterProjectionView) projectionWithSupersede() (frontend.Projection,
}, superseded
}
func (v *AdapterProjectionView) supportingReplicaReady(selfEpoch, selfEV uint64) bool {
if v == nil || v.probe == nil {
return false
}
probe, ok := v.probe.(interface {
LastOtherLine() *control.AssignmentFact
})
if !ok {
return false
}
other := probe.LastOtherLine()
if other == nil {
return false
}
return other.GetReplicaId() != v.replicaID &&
other.GetEpoch() == selfEpoch &&
other.GetEndpointVersion() == selfEV
}
// EngineProjection returns the underlying engine.ReplicaProjection
// (Mode, R/S/H, RecoveryDecision, SessionKind/Phase, Reason). Used
// by the G5-5 opt-in `/status/recovery` endpoint to surface recovery
@@ -9,15 +9,20 @@ import (
"github.com/seaweedfs/seaweed-block/core/engine"
"github.com/seaweedfs/seaweed-block/core/frontend"
control "github.com/seaweedfs/seaweed-block/core/rpc/control"
)
type stubProjector struct{ p engine.ReplicaProjection }
func (s stubProjector) Projection() engine.ReplicaProjection { return s.p }
type stubProbe struct{ yes bool }
type stubProbe struct {
yes bool
other *control.AssignmentFact
}
func (s stubProbe) IsSuperseded(string, uint64, uint64) bool { return s.yes }
func (s stubProbe) LastOtherLine() *control.AssignmentFact { return s.other }
func TestAdapterProjectionView_LocalHealthyAndNotSuperseded_IsHealthy(t *testing.T) {
p := stubProjector{p: engine.ReplicaProjection{Mode: engine.ModeHealthy, Epoch: 1, EndpointVersion: 1}}
@@ -40,6 +45,20 @@ func TestAdapterProjectionView_SupersededOverridesLocalHealthy(t *testing.T) {
}
}
func TestAdapterProjectionView_SupportingReplicaReadyIsNotFrontendHealthy(t *testing.T) {
p := stubProjector{p: engine.ReplicaProjection{Mode: engine.ModeHealthy, Epoch: 2, EndpointVersion: 1}}
v := NewAdapterProjectionView(p, "v1", "r1", stubProbe{other: &control.AssignmentFact{
VolumeId: "v1", ReplicaId: "r2", Epoch: 2, EndpointVersion: 1,
}})
got := v.Projection()
if got.Healthy {
t.Fatalf("supporting replica at same lineage must not be frontend Healthy: %+v", got)
}
if got.Epoch != 2 || got.EndpointVersion != 1 {
t.Fatalf("lineage lost under supporting replica gate: %+v", got)
}
}
func TestAdapterProjectionView_LocalDegradedStaysDegraded(t *testing.T) {
p := stubProjector{p: engine.ReplicaProjection{Mode: engine.ModeDegraded, Epoch: 1}}
v := NewAdapterProjectionView(p, "v1", "r1", stubProbe{yes: false})
+119 -17
View File
@@ -11,7 +11,8 @@ import (
"github.com/seaweedfs/seaweed-block/core/engine"
"github.com/seaweedfs/seaweed-block/core/frontend"
control "github.com/seaweedfs/seaweed-block/core/rpc/control"
"github.com/seaweedfs/seaweed-block/core/frontend/durable"
"github.com/seaweedfs/seaweed-block/core/replication"
)
// StatusServer exposes this volume host's frontend.ProjectionView
@@ -48,6 +49,16 @@ type StatusServer struct {
srv *http.Server
addr string
recoveryEnabled bool // G5-5: gates /status/recovery; off by default
peerSource peerStatusSource
durableSource durableStatusSource
}
type peerStatusSource interface {
PeerStatuses() []replication.ReplicaPeerStatus
}
type durableStatusSource interface {
DurableStatuses() []durable.VolumeStatus
}
const (
@@ -98,6 +109,25 @@ func (s *StatusServer) EnableRecoveryEndpoint() {
s.recoveryEnabled = true
}
// SetPeerStatusSource enables /status/peers by wiring a primary-side
// replication status source. It may be called before or after Start:
// the route is registered at Start, and returns 404 until a source is
// installed. This fits blockvolume startup, where the status listener
// binds before durable storage and ReplicationVolume are constructed.
func (s *StatusServer) SetPeerStatusSource(src peerStatusSource) {
s.mu.Lock()
defer s.mu.Unlock()
s.peerSource = src
}
// SetDurableStatusSource enables /status/durable by wiring the durable
// provider's read-only status surface. It may be called before or after Start.
func (s *StatusServer) SetDurableStatusSource(src durableStatusSource) {
s.mu.Lock()
defer s.mu.Unlock()
s.durableSource = src
}
// Start binds on addr and spawns the HTTP serve goroutine.
// addr MUST be a loopback host (empty-host is rejected; any
// non-loopback IP returns an error). Returns the bound addr
@@ -121,6 +151,8 @@ func (s *StatusServer) Start(addr string) (string, error) {
mux := http.NewServeMux()
mux.HandleFunc("/status", s.handleStatus)
mux.HandleFunc("/status/peers", s.handleStatusPeers)
mux.HandleFunc("/status/durable", s.handleStatusDurable)
if s.recoveryEnabled {
mux.HandleFunc("/status/recovery", s.handleStatusRecovery)
}
@@ -198,22 +230,7 @@ func (s *StatusServer) statusProjection() StatusProjection {
}
func (s *StatusServer) supportingReplicaReady(selfEpoch, selfEV uint64) bool {
if s.view == nil || s.view.probe == nil {
return false
}
probe, ok := s.view.probe.(interface {
LastOtherLine() *control.AssignmentFact
})
if !ok {
return false
}
other := probe.LastOtherLine()
if other == nil {
return false
}
return other.GetReplicaId() != s.view.replicaID &&
other.GetEpoch() == selfEpoch &&
other.GetEndpointVersion() == selfEV
return s.view.supportingReplicaReady(selfEpoch, selfEV)
}
// handleStatusRecovery returns engine.ReplicaProjection for the
@@ -252,6 +269,91 @@ func (s *StatusServer) handleStatusRecovery(w http.ResponseWriter, r *http.Reque
_ = json.NewEncoder(w).Encode(ep)
}
func (s *StatusServer) handleStatusPeers(w http.ResponseWriter, r *http.Request) {
if !isLoopbackRemote(r.RemoteAddr) {
http.Error(w, "status endpoint restricted to loopback", http.StatusForbidden)
return
}
vol := r.URL.Query().Get("volume")
if vol == "" {
http.Error(w, "missing volume query param", http.StatusBadRequest)
return
}
fp := s.view.Projection()
if fp.VolumeID != vol {
http.Error(w, fmt.Sprintf("volume %q not served by this host (serves %q)", vol, fp.VolumeID), http.StatusNotFound)
return
}
s.mu.Lock()
src := s.peerSource
s.mu.Unlock()
if src == nil {
http.NotFound(w, r)
return
}
peers := src.PeerStatuses()
body := struct {
VolumeID string
ReplicaID string
PeerCount int
Peers []replication.ReplicaPeerStatus
}{
VolumeID: fp.VolumeID,
ReplicaID: fp.ReplicaID,
PeerCount: len(peers),
Peers: peers,
}
w.Header().Set("Content-Type", "application/json")
_ = json.NewEncoder(w).Encode(body)
}
func (s *StatusServer) handleStatusDurable(w http.ResponseWriter, r *http.Request) {
if !isLoopbackRemote(r.RemoteAddr) {
http.Error(w, "status endpoint restricted to loopback", http.StatusForbidden)
return
}
vol := r.URL.Query().Get("volume")
if vol == "" {
http.Error(w, "missing volume query param", http.StatusBadRequest)
return
}
fp := s.view.Projection()
if fp.VolumeID != vol {
http.Error(w, fmt.Sprintf("volume %q not served by this host (serves %q)", vol, fp.VolumeID), http.StatusNotFound)
return
}
s.mu.Lock()
src := s.durableSource
s.mu.Unlock()
if src == nil {
http.NotFound(w, r)
return
}
var vols []durable.VolumeStatus
for _, st := range src.DurableStatuses() {
if st.VolumeID == vol {
vols = append(vols, st)
}
}
if len(vols) == 0 {
http.NotFound(w, r)
return
}
body := struct {
VolumeID string
ReplicaID string
VolumeCount int
Volumes []durable.VolumeStatus
}{
VolumeID: fp.VolumeID,
ReplicaID: fp.ReplicaID,
VolumeCount: len(vols),
Volumes: vols,
}
w.Header().Set("Content-Type", "application/json")
_ = json.NewEncoder(w).Encode(body)
}
// enforceLoopbackBind refuses to bind on anything other than
// 127.0.0.1 / ::1. Empty-host binds (":port") would listen on
// ALL interfaces and are rejected. The guard runs before the
@@ -13,6 +13,8 @@ import (
"github.com/seaweedfs/seaweed-block/core/adapter"
"github.com/seaweedfs/seaweed-block/core/engine"
"github.com/seaweedfs/seaweed-block/core/frontend/durable"
"github.com/seaweedfs/seaweed-block/core/replication"
control "github.com/seaweedfs/seaweed-block/core/rpc/control"
)
@@ -558,3 +560,231 @@ func TestStatusServer_RecoveryEndpoint_WrongVolume_Returns404(t *testing.T) {
t.Fatalf("wrong volume: got %d want 404", resp.StatusCode)
}
}
type stubPeerStatusSource struct {
peers []replication.ReplicaPeerStatus
}
func (s stubPeerStatusSource) PeerStatuses() []replication.ReplicaPeerStatus {
return append([]replication.ReplicaPeerStatus(nil), s.peers...)
}
func TestStatusServer_PeerStatusEndpoint_Disabled_Returns404(t *testing.T) {
s := NewStatusServer(NewAdapterProjectionView(stubProjector{}, "v1", "r1", nil))
addr, err := s.Start("127.0.0.1:0")
if err != nil {
t.Fatalf("start: %v", err)
}
defer func() { _ = s.Close(context.Background()) }()
resp, err := http.Get("http://" + addr + "/status/peers?volume=v1")
if err != nil {
t.Fatalf("get: %v", err)
}
defer resp.Body.Close()
if resp.StatusCode != 404 {
t.Fatalf("disabled peers endpoint: got %d want 404", resp.StatusCode)
}
}
func TestStatusServer_PeerStatusEndpoint_EnabledAfterStart_ReturnsPeerStates(t *testing.T) {
s := NewStatusServer(NewAdapterProjectionView(stubProjector{}, "v1", "r2", nil))
addr, err := s.Start("127.0.0.1:0")
if err != nil {
t.Fatalf("start: %v", err)
}
defer func() { _ = s.Close(context.Background()) }()
s.SetPeerStatusSource(stubPeerStatusSource{peers: []replication.ReplicaPeerStatus{{
ReplicaID: "r1",
State: "healthy",
Epoch: 2,
EndpointVersion: 1,
DataAddr: "127.0.0.1:19601",
CtrlAddr: "127.0.0.1:19602",
SessionID: 5,
}}})
resp, err := http.Get("http://" + addr + "/status/peers?volume=v1")
if err != nil {
t.Fatalf("get: %v", err)
}
defer resp.Body.Close()
if resp.StatusCode != 200 {
t.Fatalf("enabled peers: got %d want 200", resp.StatusCode)
}
var body struct {
VolumeID string
ReplicaID string
PeerCount int
Peers []replication.ReplicaPeerStatus
}
if err := json.NewDecoder(resp.Body).Decode(&body); err != nil {
t.Fatalf("decode: %v", err)
}
if body.VolumeID != "v1" || body.ReplicaID != "r2" || body.PeerCount != 1 {
t.Fatalf("unexpected peers body header: %+v", body)
}
if len(body.Peers) != 1 || body.Peers[0].ReplicaID != "r1" || body.Peers[0].State != "healthy" || body.Peers[0].Epoch != 2 {
t.Fatalf("unexpected peer body: %+v", body.Peers)
}
}
type stubDurableStatusSource struct {
vols []durable.VolumeStatus
}
func (s stubDurableStatusSource) DurableStatuses() []durable.VolumeStatus {
return append([]durable.VolumeStatus(nil), s.vols...)
}
func TestStatusServer_DurableStatusEndpoint_Disabled_Returns404(t *testing.T) {
s := NewStatusServer(NewAdapterProjectionView(stubProjector{}, "v1", "r1", nil))
addr, err := s.Start("127.0.0.1:0")
if err != nil {
t.Fatalf("start: %v", err)
}
defer func() { _ = s.Close(context.Background()) }()
resp, err := http.Get("http://" + addr + "/status/durable?volume=v1")
if err != nil {
t.Fatalf("get: %v", err)
}
defer resp.Body.Close()
if resp.StatusCode != 404 {
t.Fatalf("disabled durable endpoint: got %d want 404", resp.StatusCode)
}
}
func TestStatusServer_DurableStatusEndpoint_EnabledAfterStart_ReturnsLineage(t *testing.T) {
s := NewStatusServer(NewAdapterProjectionView(stubProjector{}, "v1", "r1", nil))
addr, err := s.Start("127.0.0.1:0")
if err != nil {
t.Fatalf("start: %v", err)
}
defer func() { _ = s.Close(context.Background()) }()
s.SetDurableStatusSource(stubDurableStatusSource{vols: []durable.VolumeStatus{{
VolumeID: "v1",
Path: "/tmp/v1.bin",
Impl: "smartwal",
ReplicaID: "r1",
Epoch: 1,
EndpointVersion: 1,
Latched: true,
Operational: true,
Evidence: "recovered LSN=0",
}}})
resp, err := http.Get("http://" + addr + "/status/durable?volume=v1")
if err != nil {
t.Fatalf("get: %v", err)
}
defer resp.Body.Close()
if resp.StatusCode != 200 {
t.Fatalf("enabled durable: got %d want 200", resp.StatusCode)
}
var body struct {
VolumeID string
ReplicaID string
VolumeCount int
Volumes []durable.VolumeStatus
}
if err := json.NewDecoder(resp.Body).Decode(&body); err != nil {
t.Fatalf("decode: %v", err)
}
if body.VolumeID != "v1" || body.ReplicaID != "r1" || body.VolumeCount != 1 {
t.Fatalf("unexpected durable body header: %+v", body)
}
if len(body.Volumes) != 1 || !body.Volumes[0].Latched || !body.Volumes[0].Operational || body.Volumes[0].Epoch != 1 {
t.Fatalf("unexpected durable volume body: %+v", body.Volumes)
}
}
func TestG9B_StatusProjection_ReturnedReplicaCanBeDurableReadyButFrontendNotReady(t *testing.T) {
proj := &mutableProjector{p: engine.ReplicaProjection{
Mode: engine.ModeHealthy,
Epoch: 2,
EndpointVersion: 1,
}}
h := &Host{cfg: Config{VolumeID: "v1", ReplicaID: "r1"}}
h.view = NewAdapterProjectionView(proj, "v1", "r1", h)
// Same lineage as this replica, but authority names r2. This is a
// returned supporting replica: local durable state may be recovered and
// usable by replication, but frontend I/O must remain fenced.
h.recordOtherLine(&control.AssignmentFact{
VolumeId: "v1",
ReplicaId: "r2",
Epoch: 2,
EndpointVersion: 1,
})
s := NewStatusServer(h.view)
s.SetDurableStatusSource(stubDurableStatusSource{vols: []durable.VolumeStatus{{
VolumeID: "v1",
Path: "/tmp/v1.bin",
Impl: "smartwal",
ReplicaID: "r1",
Epoch: 2,
EndpointVersion: 1,
Latched: true,
Operational: true,
Evidence: "recovered LSN=12",
}}})
addr, err := s.Start("127.0.0.1:0")
if err != nil {
t.Fatalf("start: %v", err)
}
defer func() { _ = s.Close(context.Background()) }()
statusResp, err := http.Get("http://" + addr + "/status?volume=v1")
if err != nil {
t.Fatalf("get status: %v", err)
}
defer statusResp.Body.Close()
if statusResp.StatusCode != 200 {
t.Fatalf("status: got %d want 200", statusResp.StatusCode)
}
var statusBody StatusProjection
if err := json.NewDecoder(statusResp.Body).Decode(&statusBody); err != nil {
t.Fatalf("decode status: %v", err)
}
if statusBody.VolumeID != "v1" || statusBody.ReplicaID != "r1" || statusBody.Epoch != 2 || statusBody.EndpointVersion != 1 {
t.Fatalf("returned replica status reported wrong lineage: %+v", statusBody)
}
if statusBody.Healthy || statusBody.FrontendPrimaryReady {
t.Fatalf("returned replica must not be frontend-ready: %+v", statusBody)
}
if statusBody.AuthorityRole != AuthorityRoleUnknown {
t.Fatalf("authority role=%q want %q", statusBody.AuthorityRole, AuthorityRoleUnknown)
}
if statusBody.ReplicationRole != ReplicationRoleReady {
t.Fatalf("replication role=%q want %q", statusBody.ReplicationRole, ReplicationRoleReady)
}
durableResp, err := http.Get("http://" + addr + "/status/durable?volume=v1")
if err != nil {
t.Fatalf("get durable: %v", err)
}
defer durableResp.Body.Close()
if durableResp.StatusCode != 200 {
t.Fatalf("durable: got %d want 200", durableResp.StatusCode)
}
var durableBody struct {
VolumeID string
ReplicaID string
VolumeCount int
Volumes []durable.VolumeStatus
}
if err := json.NewDecoder(durableResp.Body).Decode(&durableBody); err != nil {
t.Fatalf("decode durable: %v", err)
}
if durableBody.VolumeID != "v1" || durableBody.ReplicaID != "r1" || durableBody.VolumeCount != 1 {
t.Fatalf("returned replica durable header reported wrong identity: %+v", durableBody)
}
if len(durableBody.Volumes) != 1 {
t.Fatalf("durable volume count=%d want 1: %+v", len(durableBody.Volumes), durableBody.Volumes)
}
gotDurable := durableBody.Volumes[0]
if gotDurable.VolumeID != "v1" || gotDurable.ReplicaID != "r1" || gotDurable.Epoch != 2 || gotDurable.EndpointVersion != 1 {
t.Fatalf("returned replica durable status reported wrong lineage: %+v", gotDurable)
}
if !gotDurable.Latched || !gotDurable.Operational {
t.Fatalf("returned replica must expose local durable readiness separately: %+v", durableBody.Volumes)
}
}
+114 -26
View File
@@ -3,19 +3,24 @@ package launcher
import (
"bytes"
"fmt"
"path"
"strings"
"github.com/seaweedfs/seaweed-block/core/lifecycle"
"gopkg.in/yaml.v3"
)
const stateMountPath = "/var/lib/sw-block"
type K8sRenderConfig struct {
Namespace string
Image string
MasterAddr string
DurableRootBase string
StateHostPathBase string
RecoveryMode string
OwnerReferenceToPVC bool
EnableStatus bool
ISCSICHAP CHAPSecretRef
}
@@ -38,7 +43,10 @@ func RenderBlockVolumeDeployments(plan lifecycle.BlockVolumeWorkloadPlan, cfg K8
cfg.Image = "sw-block:local"
}
if cfg.DurableRootBase == "" {
cfg.DurableRootBase = "/var/lib/sw-block"
cfg.DurableRootBase = stateMountPath
}
if cfg.StateHostPathBase != "" && path.Clean(cfg.DurableRootBase) != stateMountPath {
return nil, fmt.Errorf("launcher: state hostPath requires durable root base %q, got %q", stateMountPath, cfg.DurableRootBase)
}
if cfg.RecoveryMode == "" {
cfg.RecoveryMode = "dual-lane"
@@ -57,6 +65,10 @@ func RenderBlockVolumeDeployments(plan lifecycle.BlockVolumeWorkloadPlan, cfg K8
out := make([]RenderedManifest, 0, len(plan.Replicas))
for _, replica := range plan.Replicas {
name := workloadName(plan.VolumeID, replica.ReplicaID)
args, err := blockVolumeArgs(plan, replica, cfg)
if err != nil {
return nil, err
}
deploy := blockVolumeDeployment{
APIVersion: "apps/v1",
Kind: "Deployment",
@@ -72,6 +84,7 @@ func RenderBlockVolumeDeployments(plan lifecycle.BlockVolumeWorkloadPlan, cfg K8
},
Spec: deploymentSpec{
Replicas: intPtr(1),
Strategy: deploymentStrategy{Type: "Recreate"},
Selector: selector{MatchLabels: map[string]string{"app": name}},
Template: podTemplate{
Metadata: metadata{Labels: map[string]string{
@@ -80,18 +93,19 @@ func RenderBlockVolumeDeployments(plan lifecycle.BlockVolumeWorkloadPlan, cfg K8
"sw-block.seaweedfs.com/replica": replica.ReplicaID,
}},
Spec: podSpec{
HostNetwork: true,
DNSPolicy: "ClusterFirstWithHostNet",
NodeSelector: map[string]string{"kubernetes.io/hostname": replica.ServerID},
HostNetwork: true,
DNSPolicy: "ClusterFirstWithHostNet",
NodeSelector: map[string]string{"kubernetes.io/hostname": replica.ServerID},
InitContainers: blockVolumeInitContainers(plan, replica, cfg),
Containers: []container{{
Name: "blockvolume",
Image: cfg.Image,
Command: []string{"/usr/local/bin/blockvolume"},
Args: blockVolumeArgs(plan, replica, cfg),
Args: args,
Env: blockVolumeEnv(cfg),
VolumeMounts: []volumeMount{{Name: "state", MountPath: "/var/lib/sw-block"}},
VolumeMounts: []volumeMount{{Name: "state", MountPath: stateMountPath}},
}},
Volumes: []volume{{Name: "state", EmptyDir: emptyDir{}}},
Volumes: []volume{stateVolume(cfg)},
},
},
},
@@ -105,6 +119,16 @@ func RenderBlockVolumeDeployments(plan lifecycle.BlockVolumeWorkloadPlan, cfg K8
return out, nil
}
func stateVolume(cfg K8sRenderConfig) volume {
if cfg.StateHostPathBase == "" {
return volume{Name: "state", EmptyDir: &emptyDir{}}
}
return volume{Name: "state", HostPath: &hostPath{
Path: path.Clean(cfg.StateHostPathBase),
Type: "DirectoryOrCreate",
}}
}
func ownerReferences(plan lifecycle.BlockVolumeWorkloadPlan, cfg K8sRenderConfig) ([]ownerReference, error) {
if !cfg.OwnerReferenceToPVC {
return nil, nil
@@ -121,7 +145,7 @@ func ownerReferences(plan lifecycle.BlockVolumeWorkloadPlan, cfg K8sRenderConfig
}}, nil
}
func blockVolumeArgs(plan lifecycle.BlockVolumeWorkloadPlan, replica lifecycle.BlockVolumeReplicaWorkload, cfg K8sRenderConfig) []string {
func blockVolumeArgs(plan lifecycle.BlockVolumeWorkloadPlan, replica lifecycle.BlockVolumeReplicaWorkload, cfg K8sRenderConfig) ([]string, error) {
args := []string{
"--master=" + cfg.MasterAddr,
"--server-id=" + replica.ServerID,
@@ -129,12 +153,19 @@ func blockVolumeArgs(plan lifecycle.BlockVolumeWorkloadPlan, replica lifecycle.B
"--replica-id=" + replica.ReplicaID,
"--data-addr=" + replica.DataAddr,
"--ctrl-addr=" + replica.CtrlAddr,
"--durable-root=" + strings.TrimRight(cfg.DurableRootBase, "/") + "/" + plan.VolumeID + "/" + replica.ReplicaID,
"--durable-root=" + durableRoot(plan, replica, cfg),
"--durable-impl=walstore",
fmt.Sprintf("--durable-blocks=%d", plan.SizeBytes/4096),
"--durable-blocksize=4096",
"--recovery-mode=" + cfg.RecoveryMode,
}
if cfg.EnableStatus {
port, err := blockVolumeStatusPort(plan, replica)
if err != nil {
return nil, err
}
args = append(args, fmt.Sprintf("--status-addr=127.0.0.1:%d", port))
}
switch plan.Protocol {
case "nvme":
args = append(args,
@@ -148,7 +179,45 @@ func blockVolumeArgs(plan lifecycle.BlockVolumeWorkloadPlan, replica lifecycle.B
"--iscsi-iqn="+replica.ISCSIQualifiedName,
)
}
return args
return args, nil
}
func blockVolumeStatusPort(plan lifecycle.BlockVolumeWorkloadPlan, replica lifecycle.BlockVolumeReplicaWorkload) (int, error) {
const offset = 20000
base := replica.ISCSIListenPort
if plan.Protocol == "nvme" && replica.NVMeListenPort > 0 {
base = replica.NVMeListenPort
}
if base <= 0 {
return 0, fmt.Errorf("launcher: status endpoint requires a positive frontend port for volume=%s replica=%s", plan.VolumeID, replica.ReplicaID)
}
port := base + offset
if port > 65535 {
return 0, fmt.Errorf("launcher: derived status port %d overflows TCP port range for volume=%s replica=%s frontend_port=%d", port, plan.VolumeID, replica.ReplicaID, base)
}
return port, nil
}
func blockVolumeInitContainers(plan lifecycle.BlockVolumeWorkloadPlan, replica lifecycle.BlockVolumeReplicaWorkload, cfg K8sRenderConfig) []container {
if cfg.StateHostPathBase == "" {
return nil
}
root := durableRoot(plan, replica, cfg)
return []container{{
Name: "state-permissions",
Image: cfg.Image,
Command: []string{"/bin/sh", "-c"},
Args: []string{fmt.Sprintf("mkdir -p %q && chown -R 65532:65532 %q", root, root)},
VolumeMounts: []volumeMount{{
Name: "state",
MountPath: stateMountPath,
}},
SecurityContext: &containerSecurityContext{RunAsUser: int64Ptr(0)},
}}
}
func durableRoot(plan lifecycle.BlockVolumeWorkloadPlan, replica lifecycle.BlockVolumeReplicaWorkload, cfg K8sRenderConfig) string {
return path.Join(cfg.DurableRootBase, plan.VolumeID, replica.ReplicaID)
}
func blockVolumeEnv(cfg K8sRenderConfig) []envVar {
@@ -202,6 +271,8 @@ func dnsLabel(s string) string {
func intPtr(v int) *int { return &v }
func int64Ptr(v int64) *int64 { return &v }
func boolPtr(v bool) *bool { return &v }
type blockVolumeDeployment struct {
@@ -227,9 +298,14 @@ type ownerReference struct {
}
type deploymentSpec struct {
Replicas *int `yaml:"replicas"`
Selector selector `yaml:"selector"`
Template podTemplate `yaml:"template"`
Replicas *int `yaml:"replicas"`
Strategy deploymentStrategy `yaml:"strategy"`
Selector selector `yaml:"selector"`
Template podTemplate `yaml:"template"`
}
type deploymentStrategy struct {
Type string `yaml:"type"`
}
type selector struct {
@@ -242,20 +318,26 @@ type podTemplate struct {
}
type podSpec struct {
HostNetwork bool `yaml:"hostNetwork"`
DNSPolicy string `yaml:"dnsPolicy"`
NodeSelector map[string]string `yaml:"nodeSelector,omitempty"`
Containers []container `yaml:"containers"`
Volumes []volume `yaml:"volumes,omitempty"`
HostNetwork bool `yaml:"hostNetwork"`
DNSPolicy string `yaml:"dnsPolicy"`
NodeSelector map[string]string `yaml:"nodeSelector,omitempty"`
InitContainers []container `yaml:"initContainers,omitempty"`
Containers []container `yaml:"containers"`
Volumes []volume `yaml:"volumes,omitempty"`
}
type container struct {
Name string `yaml:"name"`
Image string `yaml:"image"`
Command []string `yaml:"command,omitempty"`
Args []string `yaml:"args"`
Env []envVar `yaml:"env,omitempty"`
VolumeMounts []volumeMount `yaml:"volumeMounts,omitempty"`
Name string `yaml:"name"`
Image string `yaml:"image"`
Command []string `yaml:"command,omitempty"`
Args []string `yaml:"args"`
Env []envVar `yaml:"env,omitempty"`
VolumeMounts []volumeMount `yaml:"volumeMounts,omitempty"`
SecurityContext *containerSecurityContext `yaml:"securityContext,omitempty"`
}
type containerSecurityContext struct {
RunAsUser *int64 `yaml:"runAsUser,omitempty"`
}
type envVar struct {
@@ -278,8 +360,14 @@ type volumeMount struct {
}
type volume struct {
Name string `yaml:"name"`
EmptyDir emptyDir `yaml:"emptyDir"`
Name string `yaml:"name"`
EmptyDir *emptyDir `yaml:"emptyDir,omitempty"`
HostPath *hostPath `yaml:"hostPath,omitempty"`
}
type emptyDir struct{}
type hostPath struct {
Path string `yaml:"path"`
Type string `yaml:"type,omitempty"`
}
@@ -25,6 +25,7 @@ func TestG15d_K8sRenderer_RendersBlockVolumeDeploymentArgs(t *testing.T) {
for _, want := range []string{
"kind: Deployment",
"name: sw-blockvolume-pvc-a-r1",
"type: Recreate",
"hostNetwork: true",
"dnsPolicy: ClusterFirstWithHostNet",
"- /usr/local/bin/blockvolume",
@@ -44,6 +45,18 @@ func TestG15d_K8sRenderer_RendersBlockVolumeDeploymentArgs(t *testing.T) {
t.Fatalf("manifest missing %q:\n%s", want, raw)
}
}
for _, forbidden := range []string{
"--nvme-listen=",
"--nvme-subsysnqn=",
"--nvme-ns=",
} {
if strings.Contains(raw, forbidden) {
t.Fatalf("iscsi manifest must not contain %q:\n%s", forbidden, raw)
}
}
if strings.Contains(raw, "--status-addr=") {
t.Fatalf("status endpoint must be opt-in for generated manifests:\n%s", raw)
}
}
func TestG15d_K8sRenderer_RF2UsesDistinctNamesAndPorts(t *testing.T) {
@@ -59,6 +72,50 @@ func TestG15d_K8sRenderer_RF2UsesDistinctNamesAndPorts(t *testing.T) {
}
}
func TestG15d_K8sRenderer_CanUseHostPathStateVolume(t *testing.T) {
manifests, err := RenderBlockVolumeDeployments(sampleWorkloadPlan(), K8sRenderConfig{
MasterAddr: "m:9333",
DurableRootBase: "/var/lib/sw-block/",
StateHostPathBase: "/var/lib/sw-block/test-run/",
})
if err != nil {
t.Fatalf("RenderBlockVolumeDeployments: %v", err)
}
raw := string(manifests[0].YAML)
for _, want := range []string{
"hostPath:",
"path: /var/lib/sw-block/test-run",
"type: DirectoryOrCreate",
"initContainers:",
"name: state-permissions",
"runAsUser: 0",
"mkdir -p \"/var/lib/sw-block/pvc-a/r1\" && chown -R 65532:65532 \"/var/lib/sw-block/pvc-a/r1\"",
"mountPath: /var/lib/sw-block",
"--durable-root=/var/lib/sw-block/pvc-a/r1",
} {
if !strings.Contains(raw, want) {
t.Fatalf("manifest missing %q:\n%s", want, raw)
}
}
if strings.Contains(raw, "emptyDir:") {
t.Fatalf("hostPath state volume must not render emptyDir:\n%s", raw)
}
}
func TestG15d_K8sRenderer_RejectsHostPathWithDifferentContainerDurableRoot(t *testing.T) {
_, err := RenderBlockVolumeDeployments(sampleWorkloadPlan(), K8sRenderConfig{
MasterAddr: "m:9333",
DurableRootBase: "/tmp/sw-block",
StateHostPathBase: "/var/lib/sw-block/test-run",
})
if err == nil {
t.Fatal("expected error")
}
if !strings.Contains(err.Error(), "state hostPath requires durable root base") {
t.Fatalf("error=%v", err)
}
}
func TestG15d_K8sRenderer_RendersNVMeBlockVolumeArgs(t *testing.T) {
plan := sampleWorkloadPlan()
plan.Protocol = "nvme"
@@ -86,6 +143,37 @@ func TestG15d_K8sRenderer_RendersNVMeBlockVolumeArgs(t *testing.T) {
}
}
func TestG15d_K8sRenderer_CanOptIntoBlockVolumeStatusEndpoint(t *testing.T) {
manifests, err := RenderBlockVolumeDeployments(sampleWorkloadPlan(), K8sRenderConfig{
MasterAddr: "m:9333",
EnableStatus: true,
})
if err != nil {
t.Fatalf("RenderBlockVolumeDeployments: %v", err)
}
if !strings.Contains(string(manifests[0].YAML), "--status-addr=127.0.0.1:23260") {
t.Fatalf("first manifest missing status addr:\n%s", manifests[0].YAML)
}
if !strings.Contains(string(manifests[1].YAML), "--status-addr=127.0.0.1:23261") {
t.Fatalf("second manifest missing distinct status addr:\n%s", manifests[1].YAML)
}
}
func TestG15d_K8sRenderer_StatusEndpointRejectsPortOverflow(t *testing.T) {
plan := sampleWorkloadPlan()
plan.Replicas[0].ISCSIListenPort = 60000
_, err := RenderBlockVolumeDeployments(plan, K8sRenderConfig{
MasterAddr: "m:9333",
EnableStatus: true,
})
if err == nil {
t.Fatal("expected status port overflow error")
}
if !strings.Contains(err.Error(), "overflows TCP port range") {
t.Fatalf("error=%v", err)
}
}
func TestG15d_K8sRenderer_RequiresMasterAddr(t *testing.T) {
_, err := RenderBlockVolumeDeployments(sampleWorkloadPlan(), K8sRenderConfig{})
if err == nil {
@@ -54,6 +54,50 @@ func TestFileStore_CreateVolumePersistsAndIsIdempotent(t *testing.T) {
}
}
func TestFileStore_CreateVolumePersistsProtocolSelection(t *testing.T) {
s, err := OpenFileStore(t.TempDir())
if err != nil {
t.Fatalf("open: %v", err)
}
for _, tc := range []struct {
name string
spec VolumeSpec
want string
}{
{
name: "default-iscsi",
spec: VolumeSpec{VolumeID: "vol-iscsi", SizeBytes: 1 << 20, ReplicationFactor: 1},
want: "iscsi",
},
{
name: "explicit-nvme",
spec: VolumeSpec{VolumeID: "vol-nvme", SizeBytes: 1 << 20, ReplicationFactor: 1, Protocol: "nvme"},
want: "nvme",
},
} {
t.Run(tc.name, func(t *testing.T) {
rec, err := s.CreateVolume(tc.spec)
if err != nil {
t.Fatalf("create: %v", err)
}
if rec.Spec.Protocol != tc.want {
t.Fatalf("protocol=%q want %q", rec.Spec.Protocol, tc.want)
}
reopened, err := OpenFileStore(s.dir)
if err != nil {
t.Fatalf("reopen: %v", err)
}
got, ok := reopened.GetVolume(tc.spec.VolumeID)
if !ok {
t.Fatalf("reopened store missing %s", tc.spec.VolumeID)
}
if got.Spec.Protocol != tc.want {
t.Fatalf("persisted protocol=%q want %q", got.Spec.Protocol, tc.want)
}
})
}
}
func TestFileStore_CreateVolumeRejectsConflictingSpec(t *testing.T) {
s, err := OpenFileStore(t.TempDir())
if err != nil {
@@ -0,0 +1,307 @@
package ops
import (
"sort"
"strings"
"time"
"github.com/seaweedfs/seaweed-block/core/frontend/durable"
hostvolume "github.com/seaweedfs/seaweed-block/core/host/volume"
"github.com/seaweedfs/seaweed-block/core/replication"
"github.com/seaweedfs/seaweed-block/core/rpc/control"
)
const (
// VolumeStatusReportSchemaVersion is the first append-only ops status
// report contract. The report is read-only evidence, not an admin command
// input and not a block/data snapshot.
VolumeStatusReportSchemaVersion = "1.0"
Unavailable = "unavailable"
)
// VolumeStatusReportInput is the component-test seam for assembling the first
// operations-layer volume status report from existing product facts.
type VolumeStatusReportInput struct {
CapturedAt time.Time
Source ReportSource
ProductRevision string
RunnerRevision string
MasterStatus *control.StatusResponse
LocalStatus *hostvolume.StatusProjection
Peers []replication.ReplicaPeerStatus
Durable []durable.VolumeStatus
Residue ResidueReport
}
type ReportSource struct {
Component string `json:"component"`
Host string `json:"host,omitempty"`
Scenario string `json:"scenario,omitempty"`
}
type VolumeStatusReport struct {
SchemaVersion string `json:"schema_version"`
CapturedAt time.Time `json:"captured_at"`
Source ReportSource `json:"source"`
ProductRevision string `json:"product_revision"`
RunnerRevision string `json:"runner_revision,omitempty"`
Volume VolumeReport `json:"volume"`
Authority AuthorityReport `json:"authority"`
Replication ReplicationReport `json:"replication"`
Durable []DurableReport `json:"durable"`
Residue ResidueReport `json:"residue"`
}
type VolumeReport struct {
VolumeID string `json:"volume_id"`
ReplicaID string `json:"replica_id"`
Protocols []string `json:"protocols"`
Frontends []FrontendReport `json:"frontends"`
}
type FrontendReport struct {
Protocol string `json:"protocol"`
Addr string `json:"addr,omitempty"`
IQN string `json:"iqn,omitempty"`
NQN string `json:"nqn,omitempty"`
LUN uint32 `json:"lun"`
NSID uint32 `json:"nsid"`
}
type AuthorityReport struct {
Epoch uint64 `json:"epoch"`
EndpointVersion uint64 `json:"endpoint_version"`
Assigned bool `json:"assigned"`
AuthorityRole string `json:"authority_role"`
FrontendPrimaryReady bool `json:"frontend_primary_ready"`
Healthy bool `json:"healthy"`
LastUnsupportedReason string `json:"last_unsupported_reason,omitempty"`
LastConvergenceStuckAt string `json:"last_convergence_stuck_at,omitempty"`
}
type ReplicationReport struct {
ReplicationRole string `json:"replication_role"`
Peers []PeerReport `json:"peers"`
}
type PeerReport struct {
ReplicaID string `json:"replica_id"`
State string `json:"state"`
DataAddr string `json:"data_addr,omitempty"`
CtrlAddr string `json:"ctrl_addr,omitempty"`
Healthy bool `json:"healthy"`
Epoch uint64 `json:"epoch"`
EndpointVersion uint64 `json:"endpoint_version"`
SessionID uint64 `json:"session_id"`
ProbeInFlight bool `json:"probe_in_flight"`
Closed bool `json:"closed"`
LastError string `json:"last_error"`
}
type DurableReport struct {
VolumeID string `json:"volume_id"`
Impl string `json:"impl"`
Path string `json:"path"`
ReplicaID string `json:"replica_id"`
Epoch uint64 `json:"epoch"`
EndpointVersion uint64 `json:"endpoint_version"`
Latched bool `json:"latched"`
Operational bool `json:"operational"`
Closed bool `json:"closed"`
Evidence string `json:"evidence,omitempty"`
}
type ResidueReport struct {
HostInitiator HostInitiatorResidue `json:"host_initiator"`
Processes []string `json:"processes"`
Kubernetes []string `json:"kubernetes"`
StoragePaths []string `json:"storage_paths"`
}
type HostInitiatorResidue struct {
ISCSISessions []string `json:"iscsi_sessions"`
NVMESubsystems []string `json:"nvme_subsystems"`
}
// BuildVolumeStatusReport normalizes existing status surfaces into the first
// operations-layer JSON contract. It must not collect or mutate anything; all
// inputs are supplied by callers/tests.
func BuildVolumeStatusReport(in VolumeStatusReportInput) VolumeStatusReport {
capturedAt := in.CapturedAt
if capturedAt.IsZero() {
capturedAt = time.Now().UTC()
} else {
capturedAt = capturedAt.UTC()
}
volumeID, replicaID := volumeIdentity(in)
frontends := frontendSnapshots(in.MasterStatus.GetFrontends())
protocols := frontendProtocols(frontends)
source := in.Source
source.Component = explicitUnavailable(source.Component)
return VolumeStatusReport{
SchemaVersion: VolumeStatusReportSchemaVersion,
CapturedAt: capturedAt,
Source: source,
ProductRevision: explicitUnavailable(in.ProductRevision),
RunnerRevision: in.RunnerRevision,
Volume: VolumeReport{
VolumeID: volumeID,
ReplicaID: replicaID,
Protocols: protocols,
Frontends: frontends,
},
Authority: authoritySnapshot(in.MasterStatus, in.LocalStatus),
Replication: replicationSnapshot(in.LocalStatus, in.Peers),
Durable: durableSnapshots(in.Durable),
Residue: copyResidue(in.Residue),
}
}
func volumeIdentity(in VolumeStatusReportInput) (volumeID, replicaID string) {
if in.LocalStatus != nil {
volumeID = in.LocalStatus.VolumeID
replicaID = in.LocalStatus.ReplicaID
}
if volumeID == "" && in.MasterStatus != nil {
volumeID = in.MasterStatus.GetVolumeId()
}
if replicaID == "" && in.MasterStatus != nil {
replicaID = in.MasterStatus.GetReplicaId()
}
if volumeID == "" && len(in.Durable) > 0 {
volumeID = in.Durable[0].VolumeID
}
if replicaID == "" && len(in.Durable) > 0 {
replicaID = in.Durable[0].ReplicaID
}
return explicitUnavailable(volumeID), explicitUnavailable(replicaID)
}
func frontendSnapshots(targets []*control.FrontendTarget) []FrontendReport {
out := make([]FrontendReport, 0, len(targets))
for _, t := range targets {
if t == nil {
continue
}
out = append(out, FrontendReport{
Protocol: t.GetProtocol(),
Addr: t.GetAddr(),
IQN: t.GetIqn(),
NQN: t.GetNqn(),
LUN: t.GetLun(),
NSID: t.GetNsid(),
})
}
return out
}
func frontendProtocols(frontends []FrontendReport) []string {
seen := map[string]bool{}
for _, f := range frontends {
if f.Protocol == "" {
continue
}
seen[f.Protocol] = true
}
out := make([]string, 0, len(seen))
for protocol := range seen {
out = append(out, protocol)
}
sort.Strings(out)
return out
}
func authoritySnapshot(master *control.StatusResponse, local *hostvolume.StatusProjection) AuthorityReport {
s := AuthorityReport{
AuthorityRole: Unavailable,
}
if master != nil {
s.Epoch = master.GetEpoch()
s.EndpointVersion = master.GetEndpointVersion()
s.Assigned = master.GetAssigned()
s.LastUnsupportedReason = master.GetLastUnsupportedReason()
s.LastConvergenceStuckAt = master.GetLastConvergenceStuckAt()
}
if local != nil {
s.Epoch = local.Epoch
s.EndpointVersion = local.EndpointVersion
s.AuthorityRole = explicitUnavailable(local.AuthorityRole)
s.FrontendPrimaryReady = local.FrontendPrimaryReady
s.Healthy = local.Healthy
}
return s
}
func replicationSnapshot(local *hostvolume.StatusProjection, peers []replication.ReplicaPeerStatus) ReplicationReport {
s := ReplicationReport{
ReplicationRole: Unavailable,
Peers: make([]PeerReport, 0, len(peers)),
}
if local != nil {
s.ReplicationRole = explicitUnavailable(local.ReplicationRole)
}
for _, p := range peers {
s.Peers = append(s.Peers, PeerReport{
ReplicaID: p.ReplicaID,
State: p.State,
DataAddr: p.DataAddr,
CtrlAddr: p.CtrlAddr,
Healthy: strings.EqualFold(p.State, "healthy"),
Epoch: p.Epoch,
EndpointVersion: p.EndpointVersion,
SessionID: p.SessionID,
ProbeInFlight: p.ProbeInFlight,
Closed: p.Closed,
LastError: Unavailable,
})
}
return s
}
func durableSnapshots(statuses []durable.VolumeStatus) []DurableReport {
out := make([]DurableReport, 0, len(statuses))
for _, st := range statuses {
out = append(out, DurableReport{
VolumeID: st.VolumeID,
Impl: st.Impl,
Path: st.Path,
ReplicaID: st.ReplicaID,
Epoch: st.Epoch,
EndpointVersion: st.EndpointVersion,
Latched: st.Latched,
Operational: st.Operational,
Closed: st.Closed,
Evidence: st.Evidence,
})
}
return out
}
func copyResidue(in ResidueReport) ResidueReport {
return ResidueReport{
HostInitiator: HostInitiatorResidue{
ISCSISessions: copyStringSlice(in.HostInitiator.ISCSISessions),
NVMESubsystems: copyStringSlice(in.HostInitiator.NVMESubsystems),
},
Processes: copyStringSlice(in.Processes),
Kubernetes: copyStringSlice(in.Kubernetes),
StoragePaths: copyStringSlice(in.StoragePaths),
}
}
func copyStringSlice(in []string) []string {
if in == nil {
return []string{}
}
return append([]string(nil), in...)
}
func explicitUnavailable(v string) string {
if v == "" {
return Unavailable
}
return v
}
@@ -0,0 +1,102 @@
package ops
import (
"context"
"errors"
"fmt"
"time"
"github.com/seaweedfs/seaweed-block/core/frontend/durable"
hostvolume "github.com/seaweedfs/seaweed-block/core/host/volume"
"github.com/seaweedfs/seaweed-block/core/replication"
"github.com/seaweedfs/seaweed-block/core/rpc/control"
)
// VolumeStatusReportCollector is the read-only seam between product status
// sources and the stable operations report schema. Source functions should only
// read already-existing facts; authority, lifecycle, storage, frontend, or
// Kubernetes mutation belongs outside this package.
type VolumeStatusReportCollector struct {
Now func() time.Time
Source ReportSource
ProductRevision string
RunnerRevision string
MasterStatus func(context.Context) (*control.StatusResponse, error)
LocalStatus func(context.Context) (*hostvolume.StatusProjection, error)
Peers func(context.Context) ([]replication.ReplicaPeerStatus, error)
Durable func(context.Context) ([]durable.VolumeStatus, error)
Residue func(context.Context) (ResidueReport, error)
}
// Collect reads every configured source and returns the assembled report. If a
// source fails, Collect still returns a partial report from the sources that did
// succeed and returns a joined error naming the failed source.
func (c VolumeStatusReportCollector) Collect(ctx context.Context) (VolumeStatusReport, error) {
var (
errs []error
masterStatus *control.StatusResponse
localStatus *hostvolume.StatusProjection
peers []replication.ReplicaPeerStatus
durableFacts []durable.VolumeStatus
residue ResidueReport
)
if c.MasterStatus != nil {
v, err := c.MasterStatus(ctx)
if err != nil {
errs = append(errs, fmt.Errorf("collect master status: %w", err))
} else {
masterStatus = v
}
}
if c.LocalStatus != nil {
v, err := c.LocalStatus(ctx)
if err != nil {
errs = append(errs, fmt.Errorf("collect local status: %w", err))
} else {
localStatus = v
}
}
if c.Peers != nil {
v, err := c.Peers(ctx)
if err != nil {
errs = append(errs, fmt.Errorf("collect peer status: %w", err))
} else {
peers = v
}
}
if c.Durable != nil {
v, err := c.Durable(ctx)
if err != nil {
errs = append(errs, fmt.Errorf("collect durable status: %w", err))
} else {
durableFacts = v
}
}
if c.Residue != nil {
v, err := c.Residue(ctx)
if err != nil {
errs = append(errs, fmt.Errorf("collect residue status: %w", err))
} else {
residue = v
}
}
capturedAt := time.Time{}
if c.Now != nil {
capturedAt = c.Now()
}
return BuildVolumeStatusReport(VolumeStatusReportInput{
CapturedAt: capturedAt,
Source: c.Source,
ProductRevision: c.ProductRevision,
RunnerRevision: c.RunnerRevision,
MasterStatus: masterStatus,
LocalStatus: localStatus,
Peers: peers,
Durable: durableFacts,
Residue: residue,
}), errors.Join(errs...)
}
@@ -0,0 +1,235 @@
package ops
import (
"context"
"errors"
"strings"
"testing"
"time"
"github.com/seaweedfs/seaweed-block/core/frontend"
"github.com/seaweedfs/seaweed-block/core/frontend/durable"
hostvolume "github.com/seaweedfs/seaweed-block/core/host/volume"
"github.com/seaweedfs/seaweed-block/core/replication"
"github.com/seaweedfs/seaweed-block/core/rpc/control"
)
func TestVolumeStatusReportCollector_CollectsInjectedReadOnlySources(t *testing.T) {
ctx := context.Background()
calls := map[string]int{}
capturedAt := time.Date(2026, 5, 11, 21, 0, 0, 0, time.UTC)
report, err := VolumeStatusReportCollector{
Now: func() time.Time { return capturedAt },
Source: ReportSource{Component: "collector-test", Host: "m02", Scenario: "component"},
ProductRevision: "product-rev",
RunnerRevision: "runner-rev",
MasterStatus: func(context.Context) (*control.StatusResponse, error) {
calls["master"]++
return &control.StatusResponse{
VolumeId: "v1",
ReplicaId: "r1",
Epoch: 10,
EndpointVersion: 5,
Assigned: true,
Frontends: []*control.FrontendTarget{
{Protocol: "nvme", Addr: "127.0.0.1:4420", Nqn: "nqn.2026-05.io.seaweedfs:v1", Nsid: 1},
},
}, nil
},
LocalStatus: func(context.Context) (*hostvolume.StatusProjection, error) {
calls["local"]++
return &hostvolume.StatusProjection{
Projection: frontend.Projection{
VolumeID: "v1",
ReplicaID: "r1",
Epoch: 10,
EndpointVersion: 5,
Healthy: true,
},
FrontendPrimaryReady: true,
AuthorityRole: hostvolume.AuthorityRolePrimary,
ReplicationRole: hostvolume.ReplicationRoleNone,
}, nil
},
Peers: func(context.Context) ([]replication.ReplicaPeerStatus, error) {
calls["peers"]++
return []replication.ReplicaPeerStatus{{ReplicaID: "r2", State: "healthy", Epoch: 10, EndpointVersion: 5}}, nil
},
Durable: func(context.Context) ([]durable.VolumeStatus, error) {
calls["durable"]++
return []durable.VolumeStatus{{VolumeID: "v1", ReplicaID: "r1", Epoch: 10, EndpointVersion: 5, Latched: true, Operational: true}}, nil
},
Residue: func(context.Context) (ResidueReport, error) {
calls["residue"]++
return ResidueReport{HostInitiator: HostInitiatorResidue{ISCSISessions: []string{}, NVMESubsystems: []string{}}}, nil
},
}.Collect(ctx)
if err != nil {
t.Fatalf("collect: %v", err)
}
for _, name := range []string{"master", "local", "peers", "durable", "residue"} {
if calls[name] != 1 {
t.Fatalf("%s called %d times, want 1 (calls=%v)", name, calls[name], calls)
}
}
if !report.CapturedAt.Equal(capturedAt) {
t.Fatalf("captured_at=%s want %s", report.CapturedAt, capturedAt)
}
if report.Source.Component != "collector-test" || report.ProductRevision != "product-rev" || report.RunnerRevision != "runner-rev" {
t.Fatalf("metadata mismatch: %+v", report)
}
if report.Volume.VolumeID != "v1" || report.Volume.ReplicaID != "r1" || len(report.Volume.Frontends) != 1 {
t.Fatalf("volume facts mismatch: %+v", report.Volume)
}
if report.Authority.AuthorityRole != hostvolume.AuthorityRolePrimary || !report.Authority.FrontendPrimaryReady {
t.Fatalf("authority facts mismatch: %+v", report.Authority)
}
if len(report.Replication.Peers) != 1 || len(report.Durable) != 1 {
t.Fatalf("peer/durable facts mismatch: peers=%+v durable=%+v", report.Replication.Peers, report.Durable)
}
}
func TestVolumeStatusReportCollector_ReturnsPartialReportWithSourceErrors(t *testing.T) {
report, err := VolumeStatusReportCollector{
Now: func() time.Time { return time.Date(2026, 5, 11, 21, 30, 0, 0, time.UTC) },
Source: ReportSource{Component: "collector-test"},
ProductRevision: "product-rev",
MasterStatus: func(context.Context) (*control.StatusResponse, error) {
return nil, errors.New("master unavailable")
},
LocalStatus: func(context.Context) (*hostvolume.StatusProjection, error) {
return &hostvolume.StatusProjection{
Projection: frontend.Projection{
VolumeID: "v1",
ReplicaID: "r2",
Epoch: 11,
EndpointVersion: 8,
},
AuthorityRole: hostvolume.AuthorityRoleSuperseded,
ReplicationRole: hostvolume.ReplicationRoleRecovering,
}, nil
},
Peers: func(context.Context) ([]replication.ReplicaPeerStatus, error) {
return nil, errors.New("peer source down")
},
}.Collect(context.Background())
if err == nil {
t.Fatal("expected joined collection error")
}
errText := err.Error()
for _, want := range []string{"collect master status: master unavailable", "collect peer status: peer source down"} {
if !strings.Contains(errText, want) {
t.Fatalf("error %q missing %q", errText, want)
}
}
if report.Volume.VolumeID != "v1" || report.Volume.ReplicaID != "r2" {
t.Fatalf("partial report should keep local identity: %+v", report.Volume)
}
if report.Authority.AuthorityRole != hostvolume.AuthorityRoleSuperseded {
t.Fatalf("partial report should keep local authority role: %+v", report.Authority)
}
if len(report.Replication.Peers) != 0 || report.Replication.Peers == nil {
t.Fatalf("failed peer source should produce empty peers array: %+v", report.Replication.Peers)
}
if report.ProductRevision != "product-rev" {
t.Fatalf("metadata lost on partial report: %+v", report)
}
}
func TestVolumeStatusReportCollector_ReturnedReplicaDurableReadyButFrontendFenced(t *testing.T) {
report, err := VolumeStatusReportCollector{
Now: func() time.Time { return time.Date(2026, 5, 11, 22, 30, 0, 0, time.UTC) },
Source: ReportSource{Component: "collector-test", Scenario: "returned-replica"},
ProductRevision: "product-rev",
MasterStatus: func(context.Context) (*control.StatusResponse, error) {
return &control.StatusResponse{
VolumeId: "v1",
ReplicaId: "r1",
Epoch: 12,
EndpointVersion: 9,
Assigned: true,
Frontends: []*control.FrontendTarget{
{Protocol: "iscsi", Addr: "127.0.0.1:3260", Iqn: "iqn.2026-05.io.seaweedfs:v1", Lun: 0},
},
}, nil
},
LocalStatus: func(context.Context) (*hostvolume.StatusProjection, error) {
return &hostvolume.StatusProjection{
Projection: frontend.Projection{
VolumeID: "v1",
ReplicaID: "r2",
Epoch: 12,
EndpointVersion: 9,
Healthy: false,
},
FrontendPrimaryReady: false,
AuthorityRole: hostvolume.AuthorityRoleUnknown,
ReplicationRole: hostvolume.ReplicationRoleReady,
}, nil
},
Durable: func(context.Context) ([]durable.VolumeStatus, error) {
return []durable.VolumeStatus{{
VolumeID: "v1",
Impl: "smartwal",
Path: "/var/lib/sw-block/v1.blk",
ReplicaID: "r2",
Epoch: 12,
EndpointVersion: 9,
Latched: true,
Operational: true,
Evidence: "returned replica recovered durable frontier",
}}, nil
},
}.Collect(context.Background())
if err != nil {
t.Fatalf("collect: %v", err)
}
if report.Volume.VolumeID != "v1" || report.Volume.ReplicaID != "r2" {
t.Fatalf("returned replica identity mismatch: %+v", report.Volume)
}
if report.Authority.AuthorityRole != hostvolume.AuthorityRoleUnknown {
t.Fatalf("authority role=%q want %q", report.Authority.AuthorityRole, hostvolume.AuthorityRoleUnknown)
}
if report.Authority.FrontendPrimaryReady || report.Authority.Healthy {
t.Fatalf("returned replica must remain frontend-fenced: %+v", report.Authority)
}
if report.Replication.ReplicationRole != hostvolume.ReplicationRoleReady {
t.Fatalf("replication role=%q want %q", report.Replication.ReplicationRole, hostvolume.ReplicationRoleReady)
}
if len(report.Durable) != 1 {
t.Fatalf("durable entries=%d want 1", len(report.Durable))
}
gotDurable := report.Durable[0]
if gotDurable.ReplicaID != "r2" || gotDurable.Epoch != 12 || gotDurable.EndpointVersion != 9 {
t.Fatalf("durable lineage mismatch: %+v", gotDurable)
}
if !gotDurable.Latched || !gotDurable.Operational || gotDurable.Closed {
t.Fatalf("durable readiness mismatch: %+v", gotDurable)
}
if len(report.Volume.Frontends) != 1 || report.Volume.Frontends[0].LUN != 0 {
t.Fatalf("frontend facts should remain visible for evidence: %+v", report.Volume.Frontends)
}
}
func TestVolumeStatusReportCollector_NilSourcesProduceUnavailableReport(t *testing.T) {
report, err := VolumeStatusReportCollector{
Now: func() time.Time { return time.Date(2026, 5, 11, 22, 0, 0, 0, time.UTC) },
}.Collect(context.Background())
if err != nil {
t.Fatalf("nil sources should not fail: %v", err)
}
if report.Volume.VolumeID != Unavailable || report.Volume.ReplicaID != Unavailable {
t.Fatalf("volume identity should be unavailable: %+v", report.Volume)
}
if report.ProductRevision != Unavailable || report.Source.Component != Unavailable {
t.Fatalf("metadata should be explicit unavailable: product=%q source=%+v", report.ProductRevision, report.Source)
}
if report.Volume.Protocols == nil || report.Replication.Peers == nil || report.Durable == nil {
t.Fatalf("nil sources should still emit empty arrays: %+v", report)
}
}
@@ -0,0 +1,525 @@
package ops
import (
"encoding/json"
"os"
"path/filepath"
"sort"
"strings"
"testing"
"time"
"github.com/seaweedfs/seaweed-block/core/frontend"
"github.com/seaweedfs/seaweed-block/core/frontend/durable"
hostvolume "github.com/seaweedfs/seaweed-block/core/host/volume"
"github.com/seaweedfs/seaweed-block/core/replication"
"github.com/seaweedfs/seaweed-block/core/rpc/control"
)
func TestBuildVolumeStatusReport_ComposesExistingStatusSurfaces(t *testing.T) {
capturedAt := time.Date(2026, 5, 11, 12, 0, 0, 0, time.FixedZone("test", -7*3600))
report := BuildVolumeStatusReport(VolumeStatusReportInput{
CapturedAt: capturedAt,
Source: ReportSource{
Component: "component-test",
Host: "m02",
Scenario: "ops-volume-status",
},
ProductRevision: "abc123",
RunnerRevision: "runner456",
MasterStatus: &control.StatusResponse{
VolumeId: "v1",
ReplicaId: "r1",
Epoch: 1,
EndpointVersion: 1,
Assigned: true,
Frontends: []*control.FrontendTarget{
{Protocol: "nvme", Addr: "127.0.0.1:4420", Nqn: "nqn.2026-05.io.seaweedfs:v1", Nsid: 1},
{Protocol: "iscsi", Addr: "127.0.0.1:3260", Iqn: "iqn.2026-05.io.seaweedfs:v1", Lun: 0},
},
},
LocalStatus: &hostvolume.StatusProjection{
Projection: frontend.Projection{
VolumeID: "v1",
ReplicaID: "r1",
Epoch: 2,
EndpointVersion: 3,
Healthy: true,
},
FrontendPrimaryReady: true,
AuthorityRole: hostvolume.AuthorityRolePrimary,
ReplicationRole: hostvolume.ReplicationRoleNone,
},
Peers: []replication.ReplicaPeerStatus{
{
ReplicaID: "r2",
State: "healthy",
Epoch: 2,
EndpointVersion: 3,
DataAddr: "127.0.0.1:10001",
CtrlAddr: "127.0.0.1:10002",
SessionID: 99,
},
},
Durable: []durable.VolumeStatus{
{
VolumeID: "v1",
Path: "/var/lib/sw-block/v1.bin",
Impl: "smartwal",
ReplicaID: "r1",
Epoch: 2,
EndpointVersion: 3,
Latched: true,
Operational: true,
Evidence: "recover ok",
},
},
Residue: ResidueReport{
HostInitiator: HostInitiatorResidue{
ISCSISessions: []string{"tcp: [1] 127.0.0.1:3260 iqn.2026-05.io.seaweedfs:v1"},
NVMESubsystems: []string{"nqn.2026-05.io.seaweedfs:v1"},
},
Processes: []string{"blockvolume --volume v1"},
Kubernetes: []string{"deploy/sw-blockvolume-v1"},
StoragePaths: []string{"/var/lib/sw-block/v1.bin"},
},
})
if report.SchemaVersion != VolumeStatusReportSchemaVersion {
t.Fatalf("schema_version=%q", report.SchemaVersion)
}
if !report.CapturedAt.Equal(capturedAt.UTC()) {
t.Fatalf("captured_at=%s want %s", report.CapturedAt, capturedAt.UTC())
}
if report.ProductRevision != "abc123" || report.RunnerRevision != "runner456" {
t.Fatalf("revision mismatch: product=%q runner=%q", report.ProductRevision, report.RunnerRevision)
}
if report.Volume.VolumeID != "v1" || report.Volume.ReplicaID != "r1" {
t.Fatalf("volume identity mismatch: %+v", report.Volume)
}
if got, want := report.Volume.Protocols, []string{"iscsi", "nvme"}; !stringSlicesEqual(got, want) {
t.Fatalf("protocols=%v want %v", got, want)
}
if len(report.Volume.Frontends) != 2 {
t.Fatalf("frontends len=%d want 2", len(report.Volume.Frontends))
}
if report.Volume.Frontends[0].NQN == "" || report.Volume.Frontends[0].NSID != 1 {
t.Fatalf("nvme frontend not preserved: %+v", report.Volume.Frontends[0])
}
if report.Authority.Epoch != 2 || report.Authority.EndpointVersion != 3 {
t.Fatalf("authority should prefer local status lineage: %+v", report.Authority)
}
if !report.Authority.Assigned || report.Authority.AuthorityRole != hostvolume.AuthorityRolePrimary {
t.Fatalf("authority assignment/role mismatch: %+v", report.Authority)
}
if !report.Authority.Healthy || !report.Authority.FrontendPrimaryReady {
t.Fatalf("authority readiness mismatch: %+v", report.Authority)
}
if report.Replication.ReplicationRole != hostvolume.ReplicationRoleNone {
t.Fatalf("replication_role=%q", report.Replication.ReplicationRole)
}
if len(report.Replication.Peers) != 1 || !report.Replication.Peers[0].Healthy {
t.Fatalf("peer healthy derivation failed: %+v", report.Replication.Peers)
}
if report.Replication.Peers[0].LastError != Unavailable {
t.Fatalf("peer last_error=%q want unavailable", report.Replication.Peers[0].LastError)
}
if len(report.Durable) != 1 || !report.Durable[0].Latched || !report.Durable[0].Operational {
t.Fatalf("durable status mismatch: %+v", report.Durable)
}
if len(report.Residue.HostInitiator.ISCSISessions) != 1 || len(report.Residue.HostInitiator.NVMESubsystems) != 1 {
t.Fatalf("residue mismatch: %+v", report.Residue)
}
if _, err := json.Marshal(report); err != nil {
t.Fatalf("status report must marshal as JSON: %v", err)
}
}
func TestBuildVolumeStatusReport_JSONKeepsZeroValuedFrontendIdentity(t *testing.T) {
report := BuildVolumeStatusReport(VolumeStatusReportInput{
MasterStatus: &control.StatusResponse{
Frontends: []*control.FrontendTarget{
{Protocol: "iscsi", Addr: "127.0.0.1:3260", Iqn: "iqn.2026-05.io.seaweedfs:v1", Lun: 0},
{Protocol: "nvme", Addr: "127.0.0.1:4420", Nqn: "nqn.2026-05.io.seaweedfs:v1", Nsid: 1},
},
},
})
raw, err := json.Marshal(report)
if err != nil {
t.Fatal(err)
}
var decoded struct {
Volume struct {
Frontends []map[string]any `json:"frontends"`
} `json:"volume"`
}
if err := json.Unmarshal(raw, &decoded); err != nil {
t.Fatal(err)
}
if _, ok := decoded.Volume.Frontends[0]["lun"]; !ok {
t.Fatalf("iSCSI frontend JSON omitted valid lun=0: %s", raw)
}
if _, ok := decoded.Volume.Frontends[0]["nsid"]; !ok {
t.Fatalf("iSCSI frontend JSON omitted explicit nsid=0: %s", raw)
}
if _, ok := decoded.Volume.Frontends[1]["lun"]; !ok {
t.Fatalf("NVMe frontend JSON omitted explicit lun=0: %s", raw)
}
if _, ok := decoded.Volume.Frontends[1]["nsid"]; !ok {
t.Fatalf("NVMe frontend JSON omitted nsid=1: %s", raw)
}
}
func TestBuildVolumeStatusReport_JSONSchemaShapeIsStable(t *testing.T) {
report := BuildVolumeStatusReport(VolumeStatusReportInput{
CapturedAt: time.Date(2026, 5, 11, 20, 0, 0, 0, time.UTC),
ProductRevision: "product-rev",
RunnerRevision: "runner-rev",
Source: ReportSource{Component: "component-test", Host: "m02", Scenario: "schema-shape"},
MasterStatus: &control.StatusResponse{
VolumeId: "v1",
ReplicaId: "r1",
Epoch: 3,
EndpointVersion: 4,
Assigned: true,
Frontends: []*control.FrontendTarget{
{Protocol: "iscsi", Addr: "127.0.0.1:3260", Iqn: "iqn.2026-05.io.seaweedfs:v1", Lun: 0},
{Protocol: "nvme", Addr: "127.0.0.1:4420", Nqn: "nqn.2026-05.io.seaweedfs:v1", Nsid: 1},
},
},
LocalStatus: &hostvolume.StatusProjection{
Projection: frontend.Projection{
VolumeID: "v1",
ReplicaID: "r1",
Epoch: 3,
EndpointVersion: 4,
Healthy: true,
},
FrontendPrimaryReady: true,
AuthorityRole: hostvolume.AuthorityRolePrimary,
ReplicationRole: hostvolume.ReplicationRoleNone,
},
Peers: []replication.ReplicaPeerStatus{
{ReplicaID: "r2", State: "healthy", DataAddr: "127.0.0.1:10001", CtrlAddr: "127.0.0.1:10002", SessionID: 10},
},
Durable: []durable.VolumeStatus{
{VolumeID: "v1", Impl: "smartwal", Path: "/var/lib/sw-block/v1.blk", ReplicaID: "r1", Epoch: 3, EndpointVersion: 4, Latched: true, Operational: true},
},
Residue: ResidueReport{
HostInitiator: HostInitiatorResidue{ISCSISessions: []string{}, NVMESubsystems: []string{}},
Processes: []string{},
Kubernetes: []string{},
StoragePaths: []string{},
},
})
raw, err := json.Marshal(report)
if err != nil {
t.Fatal(err)
}
var doc map[string]any
if err := json.Unmarshal(raw, &doc); err != nil {
t.Fatal(err)
}
assertJSONKeys(t, "top-level", doc, []string{
"schema_version",
"captured_at",
"source",
"product_revision",
"runner_revision",
"volume",
"authority",
"replication",
"durable",
"residue",
})
assertJSONKeys(t, "source", asMap(t, doc["source"]), []string{"component", "host", "scenario"})
assertJSONKeys(t, "volume", asMap(t, doc["volume"]), []string{"volume_id", "replica_id", "protocols", "frontends"})
assertJSONKeys(t, "frontend", firstMap(t, doc["volume"], "frontends"), []string{"protocol", "addr", "iqn", "lun", "nsid"})
assertJSONKeys(t, "authority", asMap(t, doc["authority"]), []string{
"epoch",
"endpoint_version",
"assigned",
"authority_role",
"frontend_primary_ready",
"healthy",
})
assertJSONKeys(t, "replication", asMap(t, doc["replication"]), []string{"replication_role", "peers"})
assertJSONKeys(t, "peer", firstMap(t, doc["replication"], "peers"), []string{
"replica_id",
"state",
"data_addr",
"ctrl_addr",
"healthy",
"epoch",
"endpoint_version",
"session_id",
"probe_in_flight",
"closed",
"last_error",
})
assertJSONKeys(t, "durable", firstMapFromSlice(t, doc["durable"]), []string{
"volume_id",
"impl",
"path",
"replica_id",
"epoch",
"endpoint_version",
"latched",
"operational",
"closed",
})
assertJSONKeys(t, "residue", asMap(t, doc["residue"]), []string{"host_initiator", "processes", "kubernetes", "storage_paths"})
assertJSONKeys(t, "host_initiator", asMap(t, asMap(t, doc["residue"])["host_initiator"]), []string{"iscsi_sessions", "nvme_subsystems"})
}
func TestBuildVolumeStatusReport_UsesMasterFrontendFacts(t *testing.T) {
report := BuildVolumeStatusReport(VolumeStatusReportInput{
MasterStatus: &control.StatusResponse{
VolumeId: "v1",
ReplicaId: "r1",
Frontends: []*control.FrontendTarget{
{Protocol: "nvme", Addr: "127.0.0.1:4420", Nqn: "nqn.2026-05.io.seaweedfs:v1", Nsid: 1},
},
},
LocalStatus: &hostvolume.StatusProjection{
Projection: frontend.Projection{VolumeID: "v1", ReplicaID: "r1"},
},
})
if got := len(report.Volume.Frontends); got != 1 {
t.Fatalf("frontends len=%d want 1", got)
}
if report.Volume.Frontends[0].Protocol != "nvme" {
t.Fatalf("frontend should come from master StatusResponse, got %+v", report.Volume.Frontends[0])
}
}
func TestBuildVolumeStatusReport_MarksUnavailableInputsExplicitly(t *testing.T) {
report := BuildVolumeStatusReport(VolumeStatusReportInput{})
if report.ProductRevision != Unavailable {
t.Fatalf("product_revision=%q want unavailable", report.ProductRevision)
}
if report.Source.Component != Unavailable {
t.Fatalf("source.component=%q want unavailable", report.Source.Component)
}
if report.Volume.VolumeID != Unavailable || report.Volume.ReplicaID != Unavailable {
t.Fatalf("volume identity should be unavailable when not collected: %+v", report.Volume)
}
if report.Authority.AuthorityRole != Unavailable {
t.Fatalf("authority_role=%q want unavailable", report.Authority.AuthorityRole)
}
if report.Replication.ReplicationRole != Unavailable {
t.Fatalf("replication_role=%q want unavailable", report.Replication.ReplicationRole)
}
if report.Volume.Protocols == nil {
t.Fatal("protocols should be an empty JSON array, not nil")
}
if report.Volume.Frontends == nil {
t.Fatal("frontends should be an empty JSON array, not nil")
}
if report.Replication.Peers == nil {
t.Fatal("peers should be an empty JSON array, not nil")
}
if report.Durable == nil {
t.Fatal("durable should be an empty JSON array, not nil")
}
if report.Residue.HostInitiator.ISCSISessions == nil || report.Residue.HostInitiator.NVMESubsystems == nil ||
report.Residue.Processes == nil || report.Residue.Kubernetes == nil || report.Residue.StoragePaths == nil {
t.Fatalf("residue slices should be empty JSON arrays, not nil: %+v", report.Residue)
}
}
func TestBuildVolumeStatusReport_CopiesInputSlices(t *testing.T) {
residue := ResidueReport{
HostInitiator: HostInitiatorResidue{ISCSISessions: []string{"session-1"}},
Processes: []string{"proc-1"},
Kubernetes: []string{"deploy-1"},
StoragePaths: []string{"/data/v1.bin"},
}
report := BuildVolumeStatusReport(VolumeStatusReportInput{
Residue: residue,
Peers: []replication.ReplicaPeerStatus{{ReplicaID: "r2", State: "degraded"}},
Durable: []durable.VolumeStatus{{VolumeID: "v1", ReplicaID: "r1"}},
})
residue.HostInitiator.ISCSISessions[0] = "mutated"
residue.Processes[0] = "mutated"
residue.Kubernetes[0] = "mutated"
residue.StoragePaths[0] = "mutated"
if report.Residue.HostInitiator.ISCSISessions[0] != "session-1" ||
report.Residue.Processes[0] != "proc-1" ||
report.Residue.Kubernetes[0] != "deploy-1" ||
report.Residue.StoragePaths[0] != "/data/v1.bin" {
t.Fatalf("status report kept aliases to residue input: %+v", report.Residue)
}
if report.Replication.Peers[0].ReplicaID != "r2" || report.Durable[0].VolumeID != "v1" {
t.Fatalf("peer/durable copy mismatch: peers=%+v durable=%+v", report.Replication.Peers, report.Durable)
}
}
func TestBuildVolumeStatusReport_WritesSampleReportArtifact(t *testing.T) {
out := os.Getenv("SW_BLOCK_OPS_STATUS_REPORT_OUT")
if out == "" {
out = filepath.Join(t.TempDir(), "volume-status-report.json")
}
report := BuildVolumeStatusReport(VolumeStatusReportInput{
CapturedAt: time.Date(2026, 5, 11, 19, 0, 0, 0, time.UTC),
Source: ReportSource{
Component: "core/ops",
Host: "m02",
Scenario: "operations-volume-status-report-component-gate",
},
ProductRevision: "product-for-report-artifact",
RunnerRevision: "runner-for-report-artifact",
MasterStatus: &control.StatusResponse{
VolumeId: "v1",
ReplicaId: "r1",
Epoch: 7,
EndpointVersion: 2,
Assigned: true,
Frontends: []*control.FrontendTarget{
{Protocol: "iscsi", Addr: "127.0.0.1:3260", Iqn: "iqn.2026-05.io.seaweedfs:v1", Lun: 0},
{Protocol: "nvme", Addr: "127.0.0.1:4420", Nqn: "nqn.2026-05.io.seaweedfs:v1", Nsid: 1},
},
},
LocalStatus: &hostvolume.StatusProjection{
Projection: frontend.Projection{
VolumeID: "v1",
ReplicaID: "r1",
Epoch: 7,
EndpointVersion: 2,
Healthy: true,
},
FrontendPrimaryReady: true,
AuthorityRole: hostvolume.AuthorityRolePrimary,
ReplicationRole: hostvolume.ReplicationRoleNone,
},
Peers: []replication.ReplicaPeerStatus{
{ReplicaID: "r2", State: "healthy", Epoch: 7, EndpointVersion: 2},
},
Durable: []durable.VolumeStatus{
{
VolumeID: "v1",
Impl: "smartwal",
Path: "/var/lib/sw-block/v1.blk",
ReplicaID: "r1",
Epoch: 7,
EndpointVersion: 2,
Latched: true,
Operational: true,
},
},
})
raw, err := json.MarshalIndent(report, "", " ")
if err != nil {
t.Fatalf("marshal report: %v", err)
}
if err := os.MkdirAll(filepath.Dir(out), 0o755); err != nil {
t.Fatalf("mkdir artifact dir: %v", err)
}
if err := os.WriteFile(out, append(raw, '\n'), 0o644); err != nil {
t.Fatalf("write report artifact: %v", err)
}
written, err := os.ReadFile(out)
if err != nil {
t.Fatalf("read report artifact: %v", err)
}
var decoded VolumeStatusReport
if err := json.Unmarshal(written, &decoded); err != nil {
t.Fatalf("decode report artifact: %v", err)
}
if decoded.SchemaVersion != VolumeStatusReportSchemaVersion {
t.Fatalf("schema_version=%q want %q", decoded.SchemaVersion, VolumeStatusReportSchemaVersion)
}
if decoded.Volume.VolumeID != "v1" || decoded.Authority.AuthorityRole != hostvolume.AuthorityRolePrimary {
t.Fatalf("decoded report lost key fields: %+v", decoded)
}
text := string(written)
for _, want := range []string{
`"schema_version": "1.0"`,
`"volume_id": "v1"`,
`"lun": 0`,
`"nsid": 1`,
`"last_error": "unavailable"`,
`"iscsi_sessions": []`,
} {
if !strings.Contains(text, want) {
t.Fatalf("report artifact missing %s:\n%s", want, text)
}
}
}
func stringSlicesEqual(a, b []string) bool {
if len(a) != len(b) {
return false
}
for i := range a {
if a[i] != b[i] {
return false
}
}
return true
}
func assertJSONKeys(t *testing.T, label string, got map[string]any, want []string) {
t.Helper()
if len(got) != len(want) {
t.Fatalf("%s keys=%v want exactly %v", label, sortedMapKeys(got), want)
}
for _, key := range want {
if _, ok := got[key]; !ok {
t.Fatalf("%s missing JSON key %q in %v", label, key, sortedMapKeys(got))
}
}
}
func sortedMapKeys(m map[string]any) []string {
keys := make([]string, 0, len(m))
for k := range m {
keys = append(keys, k)
}
sort.Strings(keys)
return keys
}
func asMap(t *testing.T, v any) map[string]any {
t.Helper()
m, ok := v.(map[string]any)
if !ok {
t.Fatalf("expected map, got %T", v)
}
return m
}
func firstMap(t *testing.T, parent any, field string) map[string]any {
t.Helper()
items, ok := asMap(t, parent)[field].([]any)
if !ok {
t.Fatalf("expected %s array", field)
}
if len(items) == 0 {
t.Fatalf("expected %s to be non-empty", field)
}
return asMap(t, items[0])
}
func firstMapFromSlice(t *testing.T, v any) map[string]any {
t.Helper()
items, ok := v.([]any)
if !ok {
t.Fatalf("expected array, got %T", v)
}
if len(items) == 0 {
t.Fatal("expected array to be non-empty")
}
return asMap(t, items[0])
}
+35
View File
@@ -170,6 +170,22 @@ type ReplicaPeer struct {
probeInFlight bool // true while a probe attempt is dispatched and not yet recorded
}
// ReplicaPeerStatus is a diagnostic snapshot of one peer tracked by a
// primary-side ReplicationVolume. It is intentionally read-only and
// append-only: status endpoints and TestOps gates use it to assert
// peer recovery state without scraping logs.
type ReplicaPeerStatus struct {
ReplicaID string
State string
Epoch uint64
EndpointVersion uint64
DataAddr string
CtrlAddr string
SessionID uint64
ProbeInFlight bool
Closed bool
}
// NewReplicaPeer constructs a per-replica runtime handle and registers
// a live-ship session against the given executor. The session's
// lineage is derived from target.{Epoch, EndpointVersion}, a freshly
@@ -475,6 +491,25 @@ func (p *ReplicaPeer) State() ReplicaState {
return p.state
}
// Status returns a point-in-time diagnostic snapshot of the peer.
// It does not mutate peer state and is safe to call concurrently with
// write, barrier, probe, recovery, and close paths.
func (p *ReplicaPeer) Status() ReplicaPeerStatus {
p.mu.Lock()
defer p.mu.Unlock()
return ReplicaPeerStatus{
ReplicaID: p.target.ReplicaID,
State: p.state.String(),
Epoch: p.target.Epoch,
EndpointVersion: p.target.EndpointVersion,
DataAddr: p.target.DataAddr,
CtrlAddr: p.target.ControlAddr,
SessionID: p.sessionID,
ProbeInFlight: p.probeInFlight,
Closed: p.closed,
}
}
// ShipEntry ships one live WAL entry to this peer via its BlockExecutor.
// Returns error on transport failure; on error the peer is marked
// Degraded via Invalidate. A Degraded peer rejects subsequent
+16
View File
@@ -556,6 +556,22 @@ func (v *ReplicationVolume) PeerCount() int {
return len(v.peers)
}
// PeerStatuses returns a stable, sorted diagnostic snapshot of all
// currently tracked peers. This is intentionally a status surface, not
// a control surface: callers cannot mutate the returned peer state.
func (v *ReplicationVolume) PeerStatuses() []ReplicaPeerStatus {
v.mu.Lock()
defer v.mu.Unlock()
out := make([]ReplicaPeerStatus, 0, len(v.peers))
for _, peer := range v.peers {
out = append(out, peer.Status())
}
sort.Slice(out, func(i, j int) bool {
return out[i].ReplicaID < out[j].ReplicaID
})
return out
}
// ConfigureProbeLoop installs the per-volume degraded-peer probe loop.
// NOT idempotent — calling Configure twice is rejected to prevent
// silent replacement of an active loop. Configure once at volume
@@ -71,6 +71,39 @@ func TestReplicationVolume_UpdateReplicaSet_AddPeer(t *testing.T) {
}
}
func TestReplicationVolume_PeerStatuses_SortedStateSnapshot(t *testing.T) {
addr2, _ := replicaHarness(t, "r2")
addr1, _ := replicaHarness(t, "r1")
v := volumeHarness(t, "vol1")
if err := v.UpdateReplicaSet(42, []ReplicaTarget{
targetFor("r2", addr2, 3, 2),
targetFor("r1", addr1, 3, 2),
}); err != nil {
t.Fatalf("UpdateReplicaSet: %v", err)
}
v.mu.Lock()
r2 := v.peers["r2"]
v.mu.Unlock()
r2.SetState(ReplicaDegraded)
got := v.PeerStatuses()
if len(got) != 2 {
t.Fatalf("PeerStatuses len=%d want 2: %+v", len(got), got)
}
if got[0].ReplicaID != "r1" || got[1].ReplicaID != "r2" {
t.Fatalf("PeerStatuses not sorted by replica_id: %+v", got)
}
if got[0].State != "healthy" {
t.Fatalf("r1 state=%q want healthy", got[0].State)
}
if got[1].State != "degraded" {
t.Fatalf("r2 state=%q want degraded", got[1].State)
}
if got[1].Epoch != 3 || got[1].EndpointVersion != 2 || got[1].DataAddr == "" || got[1].SessionID == 0 {
t.Fatalf("r2 status missing lineage/address/session: %+v", got[1])
}
}
// --- Test 2: Opt-3 three-assertion pin ---
// TestReplicationVolume_UpdateReplicaSet_RemovePeer_ExecutorTornDown —
@@ -0,0 +1,53 @@
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: sw-block-dynamic
provisioner: block.csi.seaweedfs.com
volumeBindingMode: Immediate
allowVolumeExpansion: false
parameters:
replicationFactor: "1"
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: sw-block-demo-pvc
namespace: default
spec:
accessModes:
- ReadWriteOnce
storageClassName: sw-block-dynamic
resources:
requests:
storage: 1Mi
---
apiVersion: v1
kind: Pod
metadata:
name: sw-block-demo-writer
namespace: default
spec:
restartPolicy: Never
containers:
- name: app
image: busybox:1.36
command:
- /bin/sh
- -c
- |
set -eu
echo "[app-writer] writing through PVC mounted at /data"
dd if=/dev/urandom of=/data/demo.bin bs=4096 count=1
sha256sum /data/demo.bin > /data/demo.sha256
sync
sha256sum -c /data/demo.sha256
echo "[app-writer] wrote and verified /data/demo.bin"
echo "[app-writer] holding pod until the harness deletes it before blockvolume restart"
sleep 3600
volumeMounts:
- name: data
mountPath: /data
volumes:
- name: data
persistentVolumeClaim:
claimName: sw-block-demo-pvc
+6
View File
@@ -86,6 +86,12 @@ Current alpha constraints:
iSCSI remains the default path for broad compatibility. NVMe-oF is now
covered by ANA-aware multipath/failover and CSI protocol-selection gates.
The runtime should be managed as a cluster of explicit mini-protocols:
authority/epoch, replication recovery, iSCSI, NVMe, CSI lifecycle, and
TestOps run-control. Each mini-protocol needs structured status and tests;
avoid a single large protocol abstraction until repeated transition logic
proves it is worth extracting. See `runtime-state-machines.md`.
2. CSI dispatch is protocol-aware.
The CSI layer dispatches by frontend target protocol:
@@ -6,6 +6,44 @@ time. It is descriptive, not a normative protocol specification.
The key idea: `seaweed-block` is not one giant state machine. It is a group of
smaller loops with explicit ownership boundaries.
## Mini-Protocol Model
The runtime should be treated as a cluster of small protocols running at the
same time, not as one large protocol layer.
The authority/epoch substrate is shared, but each lifecycle has its own
protocol rules:
| Mini-protocol | Owns |
|---|---|
| Authority | identity, epoch, assignment lineage, stale-owner fencing |
| Replication | peer probing, degraded/catching-up/healthy state, rebuild eligibility |
| Frontend iSCSI | login/session, ALUA metadata, SCSI read/write/sync behavior |
| Frontend NVMe | Connect, Identify, ANA, controller/namespace identity |
| CSI lifecycle | provision, publish, stage, mount, unstage, delete |
| TestOps | run status, provenance, cleanup, artifact bundle validation |
Design rule:
```text
do not create a grand protocol layer until two mini-protocols truly share a
state transition; instead, make each mini-protocol explicit, observable, and
test-pinned.
```
For any lifecycle that can affect safety or operator trust, the expected shape
is:
1. explicit state names,
2. narrow transition points,
3. structured status or artifact evidence,
4. component tests for illegal transitions,
5. runner-native gates for OS/Kubernetes/kernel behavior.
This keeps protocol-specific semantics out of the storage engine while still
preventing hidden state machines from growing inside scattered conditionals and
log-only assertions.
## System Map
```mermaid
+14 -4
View File
@@ -12,14 +12,16 @@ Public-facing docs belong in `docs/`.
- `product-roadmap.md` is the short global product plan.
- `current-plan.md` is the active execution plan. Development should track this
file.
- When a current plan closes, rename it to `*-plan-finished.md` and create a new
`current-plan.md`.
- When a current plan closes, move it under `finished-plans/` with a
phase/topic filename such as `phase1_finishedplan_frontend_protocol_readiness.md`,
then create a new `current-plan.md`.
- Long audits and historical plans live under `ref/`. They are references, not
the day-to-day driver.
- QA assignments live under `qa-assignments/` and should be linked from
`current-plan.md` with `#QA`.
- When a plan closes, move its finished plan and related references into a
dedicated subdirectory, for example `finished/iscsi-p2/`.
- When a plan closes, keep the finished markdown plan in `finished-plans/`.
Link supporting audits, QA requests, and larger references from that plan
under `ref/` or `qa-assignments/`.
## Current Index
@@ -29,6 +31,14 @@ Public-facing docs belong in `docs/`.
| `current-plan.md` | Active development plan. Follow this first. |
| `product-management-plan.md` | Older product goals, priorities, evidence links, and decision rules. |
| `qa-assignments/` | Concrete QA tasks with commands, pass criteria, and report templates. |
| `finished-plans/` | Closed phase/topic plans retained for PM history. |
| `finished-plans/phase1_finishedplan_frontend_protocol_readiness.md` | Historical iSCSI/NVMe protocol-readiness plan closed by the protocol release gate. |
| `finished-plans/phase2_finishedplan_beta_hardening_seed.md` | Historical beta hardening seed plan. |
| `finished-plans/phase3_finishedplan_beta_seed_stabilization.md` | Historical beta seed stabilization plan. |
| `finished-plans/phase4_finishedplan_fast_gates_operations_contract_prep.md` | Historical fast-gates and operations contract prep plan. |
| `finished-plans/phase5_finishedplan_read_only_operations_status_report.md` | Historical read-only operations status report plan. |
| `finished-plans/phase6_finishedplan_iscsi_os_initiator_compatibility.md` | Historical iSCSI OS initiator compatibility plan closed by Linux and Windows validation. |
| `finished-plans/phase7_finishedplan_iscsi_session_backend_pressure.md` | Historical iSCSI session/backend pressure plan closed by fast protocol, L2 restart, and Linux OS initiator gates. |
| `ref/production-readiness-plan.md` | Longer readiness reference and iSCSI P1-P6 detail. |
| `ref/iscsi-os-initiator-compat-plan.md` | Detailed iSCSI P1 OS-initiator compatibility plan and evidence. |
| `ref/iscsi-v2-coverage-gap-audit.md` | V2-to-V3 iSCSI coverage gap audit and prioritized test backlog. |
+84 -833
View File
@@ -1,864 +1,115 @@
# Current Plan: Frontend Completeness And V2 Parity
# Current Plan: Main Merge PR Readiness
Status: active, with the iSCSI/NVMe protocol-readiness slice closed.
Status: active. Started after closing
`finished-plans/phase7_finishedplan_iscsi_session_backend_pressure.md` on
2026-05-11.
Rule: V2 frontend coverage is the minimum height for V3 unless we explicitly
drop a feature with a product reason. V3 should keep its own architecture, but
the user-visible frontend capability should reach and then exceed V2.
## Goal
References:
Prepare `plan-roadmap-refresh` for a meaningful PR to `main`.
- `ref/iscsi-v2-coverage-gap-audit.md`
- `ref/iscsi-os-initiator-compat-plan.md`
- `ref/v2-frontend-protocol-gap-audit.md`
- `ref/iscsi-csi-alua-review-guide.md`
- `ref/iscsi-p6-alua-mpio-design.md`
- `ref/iscsi-alua-technical-note.md`
- `ref/nvme-ana-parity-plan.md`
- `ref/nvme-v2-coverage-gap-audit.md`
- `ref/nvme-ana-technical-note.md`
- `ref/nvme-p4-multipath-failover-design.md`
This is not a new feature phase. The development work has already produced the
beta hardening, operations observability, iSCSI/NVMe/CSI gates, and iSCSI
pressure hardening evidence. This plan is the closeout layer that turns that
work into a reviewable integration PR.
## Current Status: Protocol Readiness Closed
## PR Scope
As of 2026-05-09, the current iSCSI/NVMe frontend protocol-readiness plan is
closed for this branch.
The PR should be framed as:
Close evidence:
```text
testops: add beta hardening gates and storage readiness evidence
```
- Runner-native protocol release gate PASS on M02:
- product commit: `033028e74c1ac3bc06f19c0563bc2e6a0495af59`,
- runner commit: `3c1b6603aefcf4c1bf0b22f9a9c081a67e786d8d`,
- suite run: `20260509-151531-9c6c`,
- wall clock: 1415.97 seconds,
- children: `iscsi-p6-alua-failover`, `nvme-p4-multipath-failover`,
`nvme-p5-csi-protocol`, and `iscsi-p8-compat-soak`, all PASS.
- `swblock validate-bundle --profile protocol-release-gate` classified the
native suite bundle as VALID.
- Post-run M02 cleanup was clean: no V3 processes and all child
`collect_and_cleanup` phases ran.
Main claims:
Decision:
- runner-native protocol and beta hardening gates,
- CSI lifecycle and RF1 durable restart coverage,
- iSCSI/NVMe protocol release gates,
- returned-replica and failover evidence gates,
- read-only operations status report support,
- Linux and Windows iSCSI OS initiator validation path,
- fast iSCSI L2 durable restart/reconnect coverage,
- planning docs organized into roadmap, finished phases, and current plan.
- iSCSI and NVMe are now release-gated protocol frontends, not active bring-up
work.
- Future iSCSI/NVMe changes should enter through regression tests, V2 parity
backlog items, or broader availability/performance gates.
- Do not treat this as full V2 product parity. Remaining work belongs to
parity/hardening: rebuild/reintegration matrices, operator lifecycle,
multi-node/cloud scale, longer soak/performance, and scenario corpus
migration.
## Required Close Checks
## Product Goal
Before opening or updating the PR:
- Keep iSCSI and NVMe credible Kubernetes block frontends, not only smoke-test
paths.
- Support real OS initiators, filesystem workloads, stress, auth, lifecycle,
multipath, and mounted failover.
- Keep protocol code separate from authority and replica readiness decisions.
- Use V2 tests as the coverage inventory, not as code to blindly copy.
1. Branch points at `main`.
2. Local branch is pushed.
3. Working tree has no tracked modifications.
4. Current finished-plan chain is coherent:
- phase1 frontend protocol readiness,
- phase2 beta hardening seed,
- phase3 beta seed stabilization,
- phase4 fast gates and operations contract prep,
- phase5 read-only operations status report,
- phase6 iSCSI OS initiator compatibility,
- phase7 iSCSI session/backend pressure hardening.
5. Core fast checks still pass or are explicitly listed as not rerun.
6. PR description is simple and human-readable.
7. Merge strategy is squash merge, so `main` does not receive the full
development commit train.
## Completed Baseline
## Suggested Validation Before PR
- iSCSI-P1 OS initiator correctness:
- status: done in PR #24.
- includes Data-Out collector, pending command handling during Data-Out,
Data-Out timeout, and Linux OS initiator evidence.
- Large READ Data-In splitting:
- status: done in PR #25.
- includes residual direction handling.
- iSCSI-P2 first stability pack:
- status: done in PR #26.
- includes RX/TX stability tests, large write memory tests, OS smoke script,
loop mode, stress mode, TestOps registry entry, and sustained sync smoke.
- iSCSI-P2 supplemental session guards:
- status: done in PR #41.
- includes rapid login/logout goroutine budget, concurrent target close
idempotency, target same-address restart, and NOP-Out queued during
Data-Out.
- iSCSI-P3 attach/detach loop tooling:
- status: done in PR #41.
- includes `scripts/run-k8s-attach-detach-loop.sh` and TestOps registry
scenario `iscsi-p3-attach-detach-loop`.
- iSCSI-P2/P3 lab validation:
- status: QA green on `iscsi/frontend-completeness@e7c95ee`.
- OS repeat, OS fio, K8s fio, and K8s attach/detach all passed on M02.
- evidence: `internal/docs/qa-assignments/iscsi-p2-p3-lab-validation.md`.
- iSCSI smoke harness cleanup:
- status: done in PR #27.
- Larger alpha PVC smoke:
- status: done in PR #28.
- Operational iSCSI target knobs:
- status: done in PR #36.
- includes portal address / externally advertised target configuration.
- PVC metadata and owner-reference plumbing:
- status: done in PR #39.
- relevant to CSI/K8s cleanup, not core iSCSI protocol.
- Owner-reference alpha default:
- status: done in PR #40.
- relevant to K8s cleanup and alpha install flow.
- iSCSI-P4 CHAP / Access Control:
- status: done in PR #41.
- includes target-side CHAP, CSI node CHAP, Kubernetes Secret wiring, and
QA evidence.
Fast local checks:
## Recently Closed Milestone: iSCSI-P2 Stability
```text
go test ./core/frontend/iscsi -run 'TestP2_ISCSI|TestP1_ISCSI|TestDataInWriter|TestDataOut' -count=1
go test -tags subprocess ./cmd/blockvolume -run 'TestISCSI_L2Durable(RestartReconnect_(PreservesData|RepeatedCycles)|SyncCacheRestart_AcceptsSyncAndPreservesWrites)' -count=1
```
- Goal:
- prevent session breakage, leaks, and unbounded memory behavior under real
OS-style traffic.
- turn the recent large I/O debugging class into repeatable local and QA
tests.
Branch/PR checks:
- Tasks:
- add RX/TX stability test pack:
- status: done in PR #26.
- supplemental guards: done in PR #41.
- rapid login/logout without goroutine leak,
- many concurrent sessions,
- target close while I/O is active,
- double close without panic,
- NOP-Out during Data-Out,
- error response StatSN behavior.
- add large write memory-pressure tests:
- status: done in PR #26.
- repeated 4 MiB writes,
- slow backend,
- heap/goroutine growth guard.
- extend real OS harness:
- status: done in PR #26.
- `SW_BLOCK_ISCSI_ITERATIONS=N`,
- `SW_BLOCK_ISCSI_STRESS=dd|fio`,
- artifact path printed,
- no active sessions after every loop.
- #QA run K8s validation after local tests:
- status: QA green on `iscsi/frontend-completeness@e7c95ee`.
- larger PVC smoke: done in PR #28.
- 60s fio: QA PASS on M02.
- larger PVC,
- 60s fio,
- daemon logs and iSCSI state captured,
- no K8s residue.
- compare against V2 remaining coverage:
- status: active.
- review whether PR #26 fully covers V2 `qa_rxtx_test.go` and
`large_write_mem_test.go` intent.
- add missing tests only if the mapping is incomplete.
```text
git status --short --branch
git rev-list --count origin/main..HEAD
git diff --stat origin/main..HEAD
```
- Close bar:
- `go test ./core/frontend/iscsi -count=1` green,
- OS initiator repeat harness green on M02,
- K8s larger PVC or fio smoke green,
- no session leaks,
- no unbounded buffer or memory behavior.
Optional if time allows:
- #QA assignment:
- `internal/docs/qa-assignments/iscsi-p2-p3-lab-validation.md`.
- status: QA green.
```text
swblock validate-bundle --profile beta-hardening <latest known green bundle>
```
## Milestone: iSCSI-P3 Product-Backed Stability
Do not rerun long suites unless review asks for fresh evidence. The beta and
protocol suites already have real-hardware green evidence in the finished
plans.
- Goal:
- prove the protocol path works with real `blockvolume`, WAL, CSI, and K8s
behavior, not only protocol fakes.
## PR Description Draft
- Tasks:
- status: done in PR #41.
- sustained write/read through mounted filesystem,
- `SYNCHRONIZE_CACHE` pressure,
- multiple sessions sharing a volume if supported,
- reconnect after logout/login,
- #QA repeated attach/detach loop,
- script prepared: `scripts/run-k8s-attach-detach-loop.sh`,
- TestOps scenario prepared: `iscsi-p3-attach-detach-loop`,
- app writer pod replaced by reader pod on the same PVC,
- blockvolume restart and reattach once durable state is ready.
```md
## Summary
- Close bar:
- checksum passes through pod path,
- no session errors,
- cleanup leaves no iSCSI or K8s residue,
- product logs are enough to diagnose failures.
Adds the beta-hardening test and operations foundation for Seaweed Block.
- QA/tooling:
- repeated attach/detach script exists:
`scripts/run-k8s-attach-detach-loop.sh`.
- TestOps registry entry exists:
`internal/testops/registry/iscsi-p3-attach-detach-loop.json`.
- default loop count comes from `SW_BLOCK_ATTACH_DETACH_ITERATIONS`.
- #QA status: PASS on M02, 3 iterations.
This includes runner-native protocol and beta gates, CSI lifecycle and durable
restart coverage, iSCSI/NVMe protocol release gates, returned-replica evidence,
read-only operations status reports, OS initiator compatibility gates, and fast
iSCSI L2 durable restart/reconnect coverage.
## Recently Closed Milestone: iSCSI-P4 CHAP / Access Control
The branch also reorganizes planning docs into roadmap, finished plans, and a
current plan so future work has a clear PM trail.
- Goal:
- reach V2-level iSCSI auth behavior before any security-facing claim.
## Validation
- Tasks:
- status: done in PR #41.
- target-side CHAP login negotiation:
- status: done in PR #41.
- direct LoginOp is rejected when CHAP is required,
- `AuthMethod=None` is rejected when CHAP is required,
- target emits CHAP MD5 challenge,
- correct username/response advances to LoginOp,
- wrong response fails closed,
- missing `CHAP_R` fails closed.
- `cmd/blockvolume` opt-in flags:
- status: done in PR #41.
- `--iscsi-chap-username`,
- `--iscsi-chap-secret`,
- flags require `--iscsi-listen`,
- username and secret must be set together.
- OS initiator CHAP smoke script:
- status: QA green.
- configure `iscsiadm` node auth before login,
- prove correct secret succeeds and wrong secret fails without residue.
- Kubernetes / CSI Secret integration:
- status: QA green on M02 at `9a1fe07`.
- CSI node consumes CHAP credentials from `NodeStageVolumeRequest.Secrets`,
- controller publish path must not copy CHAP secrets into `publish_context`,
- node configures `iscsiadm` CHAP settings after discovery and before login.
- launcher can render target-side CHAP env vars from a Kubernetes Secret,
- alpha runner can create the Secret and inject StorageClass
node-stage secret refs.
- replayed challenge rejected if supported by the protocol path,
- beta-hardening-gate: PASS twice back-to-back on m02
- protocol-release-gate: PASS on m02
- iSCSI OS initiator compatibility: Linux PASS, Windows 11 PASS
- iSCSI L2 restart/reconnect pack: PASS
- fast iSCSI protocol pressure pack: PASS
- Close bar:
- unauthenticated access fails when CHAP is required,
- authenticated access succeeds,
- failed auth leaves no partial session/device state.
## Notes
- QA/tooling:
- #QA assignment:
`internal/docs/qa-assignments/iscsi-p4-chap-lab-validation.md`.
- #QA assignment:
`internal/docs/qa-assignments/iscsi-p4-k8s-chap-validation.md`.
- #QA status:
- K8s CHAP dynamic PVC PASS on M02.
- default non-CHAP regression PASS on M02.
- V2 CHAP tests are the reference coverage inventory.
Please squash-merge this PR into main.
```
## Recently Closed Milestone: iSCSI-P5 CSI Node Lifecycle
## Non-Claims
- Goal:
- make kubelet retry/restart behavior safe enough for real clusters.
- Tasks:
- status: QA green on `iscsi/csi-node-lifecycle@4ee35c0`.
- local CSI node lifecycle guards:
- status: done in PR #41.
- NodeStage idempotency,
- mounted staging path must belong to the same volume,
- mounted staging path for another volume fails closed.
- NodeUnstage idempotency,
- unmounted staging path still logs out and removes local state.
- login failure cleanup,
- login failure does not record staged state.
- mkfs failure cleanup,
- already covered: successful login is logged out when mount fails.
- stale session detection,
- existing iSCSI login without staged volume identity fails closed,
- plugin restart may reuse an existing login only when `.volume` matches.
- plugin restart fallback,
- existing transport-file fallback covers unstage after restart.
- NodeStage restart identity is covered by `.volume`.
- repeated stage/unstage,
- local 3-cycle stage/unstage test leaves no staged state,
`.volume`, or `.transport`.
- wrong volume at staging path fails closed.
- #QA CSI node restart while PVC remains,
- script prepared: `scripts/run-k8s-csi-node-restart.sh`,
- TestOps scenario prepared: `iscsi-p5-csi-node-restart`,
- assignment: `internal/docs/qa-assignments/iscsi-p5-csi-node-lifecycle-validation.md`,
- status: QA PASS on M02.
- Close bar:
- kubelet retries do not wedge the node plugin,
- failed attach leaves no leaked device or session,
- repeated create/delete works without manual host cleanup.
- QA/tooling:
- #QA status: PASS on M02.
- manual kubelet poking is allowed only for first reproduction.
## Recently Closed Milestone: iSCSI-P6 ALUA / MPIO / Mounted Failover
- Goal:
- make mounted-volume failover a real frontend behavior instead of only a
reconnect story.
- Tasks:
- status: completed in PR #42 scope; QA green on
`iscsi/csi-node-lifecycle@d1025f1`.
- #design(iscsi-p6-alua-mpio-design) ALUA/MPIO policy and protocol shape:
- owner: dev.
- output: `internal/docs/ref/iscsi-p6-alua-mpio-design.md`.
- must be reviewed before changing protocol behavior.
- #design(iscsi-p6-qa-assignment) real initiator validation shape:
- owner: dev.
- output: `internal/docs/qa-assignments/iscsi-p6-alua-mpio-lab-validation.md`.
- must define the lab command, non-claims, and pass/fail criteria.
- V2 coverage alignment:
- status: design inventory added.
- do not copy V2 role/state ownership,
- do match V2 externally visible ALUA/MPIO protocol coverage unless V3
explicitly rejects a behavior.
- ALUA state model:
- status: local protocol slice done on `iscsi/csi-node-lifecycle`.
- active optimized,
- active non-optimized,
- standby,
- unavailable,
- transitioning.
- standby command policy:
- status: local protocol slice done; tightened by PR #42 review fix.
- metadata/path probing allowed,
- data READ, WRITE, and SYNCHRONIZE_CACHE fail closed on non-active
paths.
- standard INQUIRY TPGS discipline:
- status: local protocol slice done.
- TPGS stays off until REPORT TARGET PORT GROUPS and ALUA VPD identity
are implemented,
- when enabled, advertise implicit ALUA only unless explicit transitions
are implemented.
- REPORT TARGET PORT GROUPS:
- status: local protocol slice done.
- no-provider rejection,
- short allocation truncation,
- five-state reporting.
- VPD 0x83 target-port identity:
- status: local protocol slice done.
- NAA stable per volume,
- target port group and relative target port distinguish paths,
- short allocation length and no-ALUA branches tested.
- VPD 0x00 remains advertised-pages-equal-implemented-pages:
- status: local protocol slice done.
- state change while I/O is in flight:
- status: local protocol state-change test done.
- concurrent REPORT TARGET PORT GROUPS and standby write reject tests:
- status: done in PR #43.
- frontend state provider wiring:
- status: local P6-C slice done on `iscsi/csi-node-lifecycle`.
- connect ALUA provider to current V3 frontend facts without importing
authority or placement.
- mapping:
- frontend Healthy => active optimized,
- locally healthy but superseded/non-writable => standby,
- recovering => transitioning,
- idle supporting path => standby for metadata/path probing,
- degraded/identity mismatch => unavailable.
- path identity:
- NAA is stable per volume,
- target port group and relative target port are stable per
volume/replica path.
- multipath initiator test:
- status: QA green on `iscsi/csi-node-lifecycle@88e9301`.
- script: `scripts/run-iscsi-alua-os-smoke.sh`.
- script: `scripts/run-iscsi-alua-multipath-smoke.sh`.
- assignment: `internal/docs/qa-assignments/iscsi-p6-alua-mpio-lab-validation.md`.
- current claim: one active path reports ALUA through real Linux `sg_inq`
and `sg_rtpg`, then completes mkfs/mount/checksum/logout.
- current two-path claim: two iSCSI portals for one volume can be logged
in by Linux, report active/standby ALUA state, reject standby WRITE,
and appear as one logical device in `multipath -ll`.
- standby/probe session prerequisite: local P6-D slice implemented.
Non-active ALUA paths may use a borrowed metadata backend after
`Provider.Open` returns not-ready, so Linux can probe INQUIRY/VPD/RTPG
without allowing data I/O.
- #QA Test 1B PASS on M02:
- artifact:
`/mnt/smb/work/share/g15d-k8s/20260506T093732Z-iscsi-p6-alua-mpath-fix`.
- evidence: two iSCSI paths, common NAA, distinct TPG/RTP, r1
active/optimized, r2 standby, standby WRITE rejected, `multipath -ll`
grouped both paths under `mpatha`.
- non-claim: mounted workload failover still needs P6-E.
- primary failover while mounted:
- status: QA green on `iscsi/csi-node-lifecycle@d1025f1`.
- script: `scripts/run-iscsi-alua-mounted-failover-smoke.sh`.
- assignment: `internal/docs/qa-assignments/iscsi-p6-alua-mpio-lab-validation.md`.
- verified claim: mounted Linux multipath device can read a
pre-failover checksum and write a post-failover checksum after r1 is
killed and r2 reaches `Healthy=true` at a newer epoch.
- #QA Test 2 PASS on M02:
- artifact:
`/mnt/smb/work/share/g15d-k8s/20260506T094503Z-iscsi-p6-mounted-failover`.
- evidence: `/dev/mapper/mpatha` mounted, pre-failover checksum read
after failover, post-failover checksum written and verified, r2
promoted to `Epoch=2`, old r1 gate-rejected stale writes/syncs, no
active sessions or multipath residue after cleanup.
- old primary cannot serve stale successful I/O:
- status: QA green for killed-old-primary path on `d1025f1`.
- old-primary-return proof remains future soak/fault coverage, not required
for P6 alpha close.
- Close bar:
- real initiator sees correct ALUA/MPIO behavior,
- mounted workload survives or fails/reconnects according to documented
policy,
- byte-equal data proof after failover,
- no stale-primary success.
- QA/tooling:
- #QA active-path ALUA OS script is ready.
- #QA two-path multipath script is green on M02.
- #QA mounted multipath failover script is green on M02.
- do not rely on in-process protocol tests only.
## Recently Closed Milestone: iSCSI-P7 Performance And Backend Matrix
- Goal:
- make performance experiments comparable without turning early numbers into
product claims.
- Tasks:
- status: QA green on `iscsi/p7-performance-matrix-clean@6826139`.
- walstore baseline fio,
- smartwal fio behind explicit flag,
- Linux iSCSI loopback matrix,
- record fio summary and cleanup state.
- deferred:
- RoCE / 10.0.0.x lab path if available,
- 1GbE vs 25GbE comparison,
- pgbench scenario,
- CPU, memory, latency, and bandwidth sweep.
- script: `scripts/run-iscsi-backend-fio-matrix.sh`.
- assignment:
`internal/docs/qa-assignments/iscsi-p7-backend-fio-matrix-validation.md`.
- #QA PASS on M02:
- artifact:
`/mnt/smb/work/share/g15d-k8s/20260506T215457Z-iscsi-p7-backend-fio`.
- fio profile: 4 KiB randrw, psync, iodepth=1, size=128m,
runtime=60s.
- walstore: PASS, about 124 read IOPS / 124 write IOPS.
- smartwal: PASS, about 124 read IOPS / 125 write IOPS.
- cleanup: no active iSCSI sessions and no blockmaster/blockvolume
processes.
- non-claim: single-host loopback only, not a product performance claim.
- Close bar:
- same test runner scenario can compare backends,
- no silent backend switch,
- results are labelled experimental until SLOs exist.
- QA/tooling:
- #QA run the backend matrix on M02 first.
- #QA if RoCE is available, rerun with explicit 10.0.0.x portal path and
record the network path in the report.
- avoid manual benchmark notes without a repeatable scenario.
## Recently Closed Milestone: iSCSI-P8 Compatibility And Soak
- Goal:
- turn the current alpha iSCSI feature set into repeatable compatibility and
soak evidence without making performance claims.
- keep frontend protocol behavior stable while K8s and backend tests get
longer and more varied.
- Tasks:
- local ALUA concurrency guard:
- status: done on `iscsi/frontend-hardening`.
- cover concurrent REPORT TARGET PORT GROUPS while data READ/WRITE on a
standby path is rejected.
- closes the P6 pending item for concurrent RTPG plus standby reject.
- OS initiator soak:
- #QA green on `iscsi/frontend-hardening@38ff850`.
- repeat `run-iscsi-os-smoke.sh` with fio for a longer runtime.
- record session errors, fio summary, goroutine/process cleanup, and
final `iscsiadm -m session`.
- artifact:
`/mnt/smb/work/share/g15d-k8s/20260506T223240Z-iscsi-p8-soak-38ff850`.
- evidence:
- 2 iterations,
- 120s fio per iteration,
- `iscsiadm mkfs mount write/read logout` PASS,
- no active sessions after final cleanup.
- K8s CSI soak:
- #QA green on `iscsi/frontend-hardening@38ff850`.
- repeat attach/detach and fio paths with explicit iteration/runtime
values.
- record whether launcher owner-reference cleanup remains clean.
- evidence:
- `[alpha-fio] PASS`,
- `[attach-loop] PASS: 3 attach/detach app PVC cycles completed`,
- no sw-block PVC or deployment residue.
- compatibility matrix:
- #QA green for M02.
- document exact host distro, kernel, open-iscsi version, fio version,
and sg3-utils/multipath versions when used.
- add more hosts only when the first soak is repeatable.
- Close bar:
- local protocol concurrency tests green,
- one OS fio soak green,
- one K8s attach/detach or fio soak green,
- all runs leave no active sessions, mounts, multipath maps, or K8s residue.
- QA/tooling:
- prefer wrappers with env knobs over manual command sequences.
- label all runtime/throughput numbers as soak evidence, not benchmark
claims.
- #QA assignment:
`internal/docs/qa-assignments/iscsi-p8-compat-soak-validation.md`.
- #QA status:
- PASS on M02 at `38ff850`.
- final line:
`[iscsi-soak] PASS: compatibility soak completed`.
- non-claim:
compatibility probe only, not a long-running soak or performance claim.
## Recently Closed Milestone: TestOps For Frontend Lab Gates
- Goal:
- reduce false failures from manual multi-step lab runs by moving P8-style
gates into one TestOps entry point.
- keep existing shell scripts as the execution backend first; do not rewrite
all harness logic before the gate is stable.
- Tasks:
- #QA package P8 compatibility soak as a TestOps scenario:
- status: done; wrapper proven green in standalone runner and carried back
into the product planning flow.
- must record commit SHA, command, artifact root, step result, final line,
and cleanup status in a single result file.
- initial scenario may call `scripts/run-iscsi-compat-soak.sh`.
- pin alpha image build/import before K8s frontend gates:
- status: QA green at `c3a6e28`; workload composition hook active in this
branch.
- script: `scripts/build-alpha-images.sh`.
- TestOps scenario: `alpha-images-pin-build`.
- contract:
- build `sw-block:local` and `sw-block-csi:local`,
- optionally import both images into k3s containerd with
`SW_BLOCK_IMPORT_K3S=1`,
- record Docker image IDs,
- record `blockmaster`, `blockvolume`, and `blockcsi` `--version`
output,
- downstream K8s harnesses may consume the build output with
`SW_BLOCK_ALPHA_IMAGES_ENV=/path/to/pin-build/alpha-images.env`,
- fail before protocol smoke tests if build/import/version capture fails.
- composed TestOps workload scenarios:
- status: QA green at `cf9183a`.
- `nvme-p5-csi-dynamic`,
- `nvme-p5-default-iscsi-regression`.
- developer-owned P5 suite:
- status: QA green at `67592f2`.
- `scripts/testops-run-nvme-p5-suite.sh`,
- runs pin-build, then both P5 workload scenarios,
- passes `alpha-images.env` forward mechanically,
- writes one suite-level `result.json`.
- reason:
- NVMe-P5 showed that stale k3s images can mimic product protocol bugs.
The build/import step must be one reviewed gate, not manual lab memory.
- platform extraction target:
- status: seed shape extracted into standalone runner and native suite
flow; continue hardening in runner repo.
- port this V3 reference implementation into reusable runner primitives:
- `testops_pin_build` for build/import/version/image provenance,
- `consume_pin` for passing pinned outputs between phases,
- `assert_revision_matches` for component/runtime SHA checks,
- suite linkage that passes prior phase outputs without ad-hoc env-file
conventions.
- reference hardware evidence:
- `alpha-images-pin-build` PASS at `cf9183a`,
- `nvme-p5-csi-dynamic` PASS at `cf9183a`,
- `nvme-p5-default-iscsi-regression` PASS at `cf9183a`.
- runner-native protocol release suite:
- status: QA green on M02 at product `033028e` and runner `3c1b660`.
- suite: `testops/suites/protocol-release-gate.yaml`.
- command shape:
`swblock suite --results-dir <root> --env product_root=<remote-root>
--env ssh_key=<key> testops/suites/protocol-release-gate.yaml`.
- children:
- `iscsi-p6-alua-failover-chain`,
- `nvme-p4-multipath-failover-chain`,
- `nvme-p5-csi-protocol-chain`,
- `iscsi-p8-compat-soak-chain`.
- validation:
`swblock validate-bundle --profile protocol-release-gate <suite-run>`.
- define the minimal result contract:
- scenario name,
- repository SHA,
- host,
- step table,
- artifact paths,
- cleanup checks.
- keep product development unblocked:
- TestOps work should not change iSCSI protocol code.
- product branches can continue using scripts until TestOps reaches parity.
- Close bar:
- one command runs the P8 full lab gate,
- old-commit/stale-binary ambiguity is impossible or explicitly reported,
- result file is enough for review without reading raw terminal output.
- one runner-native command runs the full iSCSI/NVMe/CSI/soak release gate,
and `validate-bundle --profile protocol-release-gate` accepts the bundle.
- QA/tooling:
- Dev owns the core test content and uses TestOps as the primary dev loop.
- QA may run the same scenarios, add lab automation, and improve collection,
but should not be the only path that can execute a gate end-to-end.
- prefer small TestOps wrapper over a wholesale scenario DSL rewrite.
## Recently Closed Milestone: NVMe-oF / ANA Parity Planning
- Goal:
- bring NVMe-oF up to the same product discipline as the now-green iSCSI
frontend.
- treat V2 NVMe behavior as the feature floor, not code to copy blindly.
- understand the old high-performance path before touching protocol code.
- Reference:
- `internal/docs/ref/nvme-ana-parity-plan.md`.
- `internal/docs/ref/nvme-v2-coverage-gap-audit.md`.
- Tasks:
- NVMe-P0 audit:
- status: initial audit done; keep updating as code lands.
- compare V2 NVMe implementation and scenarios against current V3.
- classify every visible feature as present, missing, intentionally
deferred, or rejected with product reason.
- specifically answer whether the remembered "control API carries data"
path was standard NVMe/TCP in-capsule data or a custom V2 shortcut.
- initial answer: standard in-capsule data; no custom V2 vendor/admin data
command found in the NVMe package.
- NVMe-P1 OS kernel baseline:
- status: QA green on M02.
- script: `scripts/run-nvme-os-smoke.sh`.
- #QA assignment:
`internal/docs/qa-assignments/nvme-p1-os-smoke-validation.md`.
- #QA evidence:
- basic OS path PASS on M02,
- 60s fio PASS on M02,
- loopback 4 KiB fio used inline writes only,
- no test NQN or process residue after cleanup.
- build a repeatable `nvme connect -> mkfs -> mount -> fio/checksum ->
disconnect` script.
- dynamic ports only.
- no stale sessions or target processes.
- NVMe-P2 in-capsule / R2T performance path:
- status: QA green on M02 with host-specific classification.
- target now reports transport counters in `blockvolume.log` on close:
inline writes, R2T writes, H2C/C2H PDU counts, and read/write/flush
command counts.
- P1 observation: Linux `fio --bs=4k` used inline writes exclusively on
M02 (`r2t_writes=0`).
- P2 observation: Linux kernel 6.17.0-19 on M02 did not trigger R2T even
for `fio --bs=128k` or `dd bs=1M`; all writes were fragmented into
inline/in-capsule transfers.
- #QA assignment:
`internal/docs/qa-assignments/nvme-p2-inline-r2t-validation.md`.
- prove whether Linux uses inline data for small writes.
- run 128 KiB+ profiles to force or classify the R2T path.
- add visible counters or artifacts for inline vs R2T writes.
- follow-up:
- R2T requires a different initiator/profile or target-side test knob;
current M02 kernel behavior is not a product failure.
- compare iSCSI and NVMe only under labelled network/backend conditions.
- NVMe-P3 ANA identity and log page:
- status: QA green on M02 at `d330e89`.
- provider: `core/frontend/nvme.ANAProvider`.
- product wiring: `cmd/blockvolume` derives ANA state from the same
frontend projection used by iSCSI ALUA.
- log page: admin Get Log Page `0x0c` returns one ANA group when a
provider is configured.
- mapping:
- frontend Healthy => optimized,
- superseded healthy / idle supporting path => non-optimized,
- recovering => ANA change,
- degraded / identity mismatch => inaccessible.
- guard: Identify Controller / Namespace ANA fields remain zero without a
provider.
- P3-C behavior: with a provider, Identify Controller advertises ANA,
Identify Namespace carries the provider's ANA group, and Get Log Page ANA
reports the same group/state.
- OAES ANA Change Notice remains off; no async event producer exists yet.
- #QA assignment:
`internal/docs/qa-assignments/nvme-p3-ana-log-validation.md`.
- #QA evidence:
- ANA log `group_id=1`, `state=0x01`, `nsid=1`,
- Identify Controller `cmic=0x8`, `anagrpmax=1`, `nanagrpid=1`,
- Identify Namespace `anagrpid=1`,
- no `nvme_parse_ana_log` kernel warning,
- mkfs/mount/checksum PASS after ANA advertisement is enabled.
- NVMe-P4 multipath and mounted failover:
- status: fully QA green on M02 at `e1e0e0c`.
- #design:
`internal/docs/ref/nvme-p4-multipath-failover-design.md`.
- #QA assignment:
`internal/docs/qa-assignments/nvme-p4-multipath-lab-validation.md`.
- reach the iSCSI P6 bar for NVMe multipath.
- Test 1/2 discovery and native grouping:
- status: QA green on M02 at `a5ef1a5`.
- script: `scripts/run-nvme-multipath-smoke.sh`.
- evidence:
- run ID `20260507T161800Z-test`,
- two NVMe/TCP paths registered immediately,
- native Linux multipath exposed one namespace device,
- ANA log `group_id=1`, `state=0x01 optimized`, `nsid=1`,
- identity `nguid=24634c35194743419febbb18e06446be`,
`eui64=24634c3519474341`, `anagrpid=1`,
- final line:
`[nvme-mpath] PASS: two NVMe/TCP paths expose one ANA-aware namespace`.
- decision: single ANA group is sufficient for the current two-path
native multipath identity model.
- mounted failover:
- status: QA green on M02 at `e1e0e0c`.
- script: `scripts/run-nvme-mounted-failover-smoke.sh`.
- local guard:
- metadata-only standby NVMe path continues to reject I/O before
promotion,
- after ANA state becomes optimized, the same session can pass I/O to
the backend.
- #QA evidence:
- run ID `20260507T170000Z-nvme-p4-mounted-failover`,
- two TCP paths registered and Linux native multipath merged them to
`/dev/nvme1n1`,
- mounted ext4 workload survived active r1 kill,
- r2 promoted to `Epoch=2`, `AuthorityRole=primary`,
`FrontendPrimaryReady=true`,
- `pre.bin` checksum remained OK after failover,
- `post.bin` write/read/verify succeeded after failover,
- cleanup left no test NQN and no blockmaster/blockvolume process.
- NVMe-P5 CSI integration:
- status: QA green on `frontend/nvme-ana-parity-plan@8e0a28f`.
- latest QA:
- red at `622fae7`: StorageClass rendered `protocol: nvme`, but
lifecycle intent had no protocol and generated blockvolume still used
iSCSI args.
- red at `a1d5201`: live StorageClass carried both protocol keys, but
persisted lifecycle JSON still had no `protocol`; current source has
protocol on CSI/RPC/lifecycle, so the harness now gates component
`--version` output to catch stale K8s images before protocol checks.
- green at `69a1d20`: Test 1 NVMe dynamic PVC passed after rebuilt and
k3s-imported images; lifecycle persisted `protocol: "nvme"` and
launcher emitted NVMe args only.
- green at `8e0a28f`: Test 2 default iSCSI regression passed; all three
version gates matched HEAD, lifecycle persisted `protocol: "iscsi"`,
generated manifest used iSCSI args only, and cleanup left no iSCSI or
NVMe residue.
- current fix: prefer product-scoped
`sw-block.seaweedfs.com/protocol`, keep `protocol` as compatibility,
delete stale cluster-scoped StorageClass before apply, capture
`storageclass.live.yaml`, and record `--version` for blockmaster,
blockcsi, and generated blockvolume before judging launcher output.
- allow StorageClass protocol selection without changing the app.
- default StorageClass path stays iSCSI.
- `parameters.sw-block.seaweedfs.com/protocol: nvme` selects NVMe target
facts end-to-end:
- CSI CreateVolume records protocol in lifecycle intent,
- master lifecycle RPC carries protocol,
- launcher renders `blockvolume` with `--nvme-listen`,
`--nvme-subsysnqn`, and `--nvme-ns`,
- CSI ControllerPublish returns `protocol=nvme`, `nvmeAddr`, and `nqn`,
- CSI NodeStage uses `nvme connect`, formats/mounts the NVMe namespace,
and disconnects by NQN on NodeUnstage.
- K8s harness:
- script: `scripts/run-k8s-alpha-nvme.sh`,
- underlying env knob: `SW_BLOCK_FRONTEND_PROTOCOL=nvme`,
- dynamic PVC/app manifest remains unchanged except injected
StorageClass parameter.
- #QA assignment:
`internal/docs/qa-assignments/nvme-p5-csi-protocol-selection-validation.md`.
- platform lesson:
- stale k3s images cost multiple lab rounds; TestOps pin-build/import
should make build, k3s image import, digest capture, and component
version verification one required step for future release gates.
- NVMe-P6 RoCE / network performance matrix:
- status: deferred to future network/performance plan.
- correctness gates are green; RoCE is no longer part of protocol
readiness closure.
- Close bar for the planning slice:
- audit table exists,
- next code task has a red test or lab reproduction,
- no ANA or performance claim is enabled before matching host evidence.
- QA/tooling:
- protocol assignments remain as historical evidence under
`internal/docs/qa-assignments/`.
- future protocol changes should update the runner-native release gate rather
than adding manual-only QA instructions.
## Current Active Milestone: V2 Parity And Hardening Backlog
- Goal:
- keep iSCSI/NVMe protocol readiness protected by the release gate while
moving active development to remaining V2 parity, product hardening, and
TestOps platform work.
- Work buckets:
- V2 parity audit:
- compare the old `weed/storage/blockvol` scenario corpus against current
V3 capabilities,
- classify each gap as already covered by the release gate, still missing,
intentionally deferred, or rejected with product reason.
- availability/recovery hardening:
- replica return and reintegration,
- RF2/RF3 rebuild and failover matrices,
- WAL retention and flow-control pressure,
- longer soak and failure-injection runs.
- Kubernetes/operator hardening:
- durable blockvolume state beyond throwaway alpha defaults,
- operator/controller lifecycle,
- multi-node attach and non-loopback frontend addressing.
- TestOps platform:
- keep product-owned scenarios in this repo,
- move repeated primitives into the standalone runner,
- use native suite/run-control/validate-bundle for release evidence,
- explore controller/agent mode separately from the open SSH runner path.
- Close bar for the next planning slice:
- a V2 parity matrix exists with explicit disposition per feature/scenario,
- at least one non-protocol hardening gate is runner-native and repeatable,
- protocol release gate remains green after unrelated hardening changes.
## Cross-Cutting Technical Rules
- Protocol code must not decide authority.
- Protocol code must not decide replica readiness.
- CSI must consume frontend facts, not infer storage truth.
- Placement intent is not authority.
- Authority movement is not data continuity.
- Best-effort ACK is not full durability.
- If V2 behavior is copied, copy the test expectation first and adapt the code
to V3 boundaries.
## QA / TestOps Rules
- Prefer scripts or TestOps scenarios over manual command sequences.
- Manual testing is allowed for first reproduction, but convert the result into
a repeatable script or scenario.
- Keep default `go test` focused on unit/component coverage.
- Local binary wiring tests that build product binaries, spawn
`blockmaster`/`blockvolume`, and use loopback protocol clients must use the
explicit `subprocess` build tag. These are not m01/m02 lab integration tests.
- Linux OS/K8s/lab tests that use `iscsiadm`, `nvme-cli`, kernel initiators,
mounts, `sudo`, or m01/m02 cleanup state belong in runner-native TestOps
scenarios, not default `go test` and not the local `subprocess` tag.
- When a subprocess or runner integration test fails, first ask whether its
assertion can be moved down to a component seam such as authority, engine
projection, frontend protocol adapter, lifecycle rendering, or
ready-assignment handling. Keep only binary wiring, real OS frontend I/O,
process lifecycle, and lab cleanup in the runner layer.
- QA report must include:
- branch and commit,
- command,
- lab host,
- result,
- artifact path,
- cleanup state,
- exact log line for any failure.
## PR Cadence
- Use milestone PRs, not one PR per tiny fix.
- Target one or two PRs per day at most.
- For the current active milestone, keep parity matrix updates, non-protocol
hardening gates, and runner scenario changes grouped by reviewable outcome.
- Split OS/K8s harness work only if it becomes too large to review cleanly.
## Finish Action
- When a milestone closes, move the finished plan and related references into a
dedicated directory, for example `internal/docs/finished/iscsi-p2/`.
- Keep `current-plan.md` focused on the next active milestone.
- This plan does not add new runtime behavior.
- This plan does not add new test coverage beyond final closeout edits.
- This plan does not require another full beta suite run unless reviewers ask.
- This plan does not decide the next product feature phase after merge.
@@ -0,0 +1,869 @@
# Finished Plan: iSCSI/NVMe Frontend Protocol Readiness
Status: historical reference. Closed on 2026-05-09 by the runner-native
protocol release gate.
This phase/topic file preserves the plan that brought iSCSI and NVMe from active
frontend bring-up to release-gated protocol coverage. It is no longer the active
execution plan. Current work is tracked in `../current-plan.md`.
Rule: V2 frontend coverage is the minimum height for V3 unless we explicitly
drop a feature with a product reason. V3 should keep its own architecture, but
the user-visible frontend capability should reach and then exceed V2.
References:
- `ref/iscsi-v2-coverage-gap-audit.md`
- `ref/iscsi-os-initiator-compat-plan.md`
- `ref/v2-frontend-protocol-gap-audit.md`
- `ref/iscsi-csi-alua-review-guide.md`
- `ref/iscsi-p6-alua-mpio-design.md`
- `ref/iscsi-alua-technical-note.md`
- `ref/nvme-ana-parity-plan.md`
- `ref/nvme-v2-coverage-gap-audit.md`
- `ref/nvme-ana-technical-note.md`
- `ref/nvme-p4-multipath-failover-design.md`
## Current Status: Protocol Readiness Closed
As of 2026-05-09, the current iSCSI/NVMe frontend protocol-readiness plan is
closed for this branch.
Close evidence:
- Runner-native protocol release gate PASS on M02:
- product commit: `033028e74c1ac3bc06f19c0563bc2e6a0495af59`,
- runner commit: `3c1b6603aefcf4c1bf0b22f9a9c081a67e786d8d`,
- suite run: `20260509-151531-9c6c`,
- wall clock: 1415.97 seconds,
- children: `iscsi-p6-alua-failover`, `nvme-p4-multipath-failover`,
`nvme-p5-csi-protocol`, and `iscsi-p8-compat-soak`, all PASS.
- `swblock validate-bundle --profile protocol-release-gate` classified the
native suite bundle as VALID.
- Post-run M02 cleanup was clean: no V3 processes and all child
`collect_and_cleanup` phases ran.
Decision:
- iSCSI and NVMe are now release-gated protocol frontends, not active bring-up
work.
- Future iSCSI/NVMe changes should enter through regression tests, V2 parity
backlog items, or broader availability/performance gates.
- Do not treat this as full V2 product parity. Remaining work belongs to
parity/hardening: rebuild/reintegration matrices, operator lifecycle,
multi-node/cloud scale, longer soak/performance, and scenario corpus
migration.
## Product Goal
- Keep iSCSI and NVMe credible Kubernetes block frontends, not only smoke-test
paths.
- Support real OS initiators, filesystem workloads, stress, auth, lifecycle,
multipath, and mounted failover.
- Keep protocol code separate from authority and replica readiness decisions.
- Use V2 tests as the coverage inventory, not as code to blindly copy.
## Completed Baseline
- iSCSI-P1 OS initiator correctness:
- status: done in PR #24.
- includes Data-Out collector, pending command handling during Data-Out,
Data-Out timeout, and Linux OS initiator evidence.
- Large READ Data-In splitting:
- status: done in PR #25.
- includes residual direction handling.
- iSCSI-P2 first stability pack:
- status: done in PR #26.
- includes RX/TX stability tests, large write memory tests, OS smoke script,
loop mode, stress mode, TestOps registry entry, and sustained sync smoke.
- iSCSI-P2 supplemental session guards:
- status: done in PR #41.
- includes rapid login/logout goroutine budget, concurrent target close
idempotency, target same-address restart, and NOP-Out queued during
Data-Out.
- iSCSI-P3 attach/detach loop tooling:
- status: done in PR #41.
- includes `scripts/run-k8s-attach-detach-loop.sh` and TestOps registry
scenario `iscsi-p3-attach-detach-loop`.
- iSCSI-P2/P3 lab validation:
- status: QA green on `iscsi/frontend-completeness@e7c95ee`.
- OS repeat, OS fio, K8s fio, and K8s attach/detach all passed on M02.
- evidence: `internal/docs/qa-assignments/iscsi-p2-p3-lab-validation.md`.
- iSCSI smoke harness cleanup:
- status: done in PR #27.
- Larger alpha PVC smoke:
- status: done in PR #28.
- Operational iSCSI target knobs:
- status: done in PR #36.
- includes portal address / externally advertised target configuration.
- PVC metadata and owner-reference plumbing:
- status: done in PR #39.
- relevant to CSI/K8s cleanup, not core iSCSI protocol.
- Owner-reference alpha default:
- status: done in PR #40.
- relevant to K8s cleanup and alpha install flow.
- iSCSI-P4 CHAP / Access Control:
- status: done in PR #41.
- includes target-side CHAP, CSI node CHAP, Kubernetes Secret wiring, and
QA evidence.
## Recently Closed Milestone: iSCSI-P2 Stability
- Goal:
- prevent session breakage, leaks, and unbounded memory behavior under real
OS-style traffic.
- turn the recent large I/O debugging class into repeatable local and QA
tests.
- Tasks:
- add RX/TX stability test pack:
- status: done in PR #26.
- supplemental guards: done in PR #41.
- rapid login/logout without goroutine leak,
- many concurrent sessions,
- target close while I/O is active,
- double close without panic,
- NOP-Out during Data-Out,
- error response StatSN behavior.
- add large write memory-pressure tests:
- status: done in PR #26.
- repeated 4 MiB writes,
- slow backend,
- heap/goroutine growth guard.
- extend real OS harness:
- status: done in PR #26.
- `SW_BLOCK_ISCSI_ITERATIONS=N`,
- `SW_BLOCK_ISCSI_STRESS=dd|fio`,
- artifact path printed,
- no active sessions after every loop.
- #QA run K8s validation after local tests:
- status: QA green on `iscsi/frontend-completeness@e7c95ee`.
- larger PVC smoke: done in PR #28.
- 60s fio: QA PASS on M02.
- larger PVC,
- 60s fio,
- daemon logs and iSCSI state captured,
- no K8s residue.
- compare against V2 remaining coverage:
- status: active.
- review whether PR #26 fully covers V2 `qa_rxtx_test.go` and
`large_write_mem_test.go` intent.
- add missing tests only if the mapping is incomplete.
- Close bar:
- `go test ./core/frontend/iscsi -count=1` green,
- OS initiator repeat harness green on M02,
- K8s larger PVC or fio smoke green,
- no session leaks,
- no unbounded buffer or memory behavior.
- #QA assignment:
- `internal/docs/qa-assignments/iscsi-p2-p3-lab-validation.md`.
- status: QA green.
## Milestone: iSCSI-P3 Product-Backed Stability
- Goal:
- prove the protocol path works with real `blockvolume`, WAL, CSI, and K8s
behavior, not only protocol fakes.
- Tasks:
- status: done in PR #41.
- sustained write/read through mounted filesystem,
- `SYNCHRONIZE_CACHE` pressure,
- multiple sessions sharing a volume if supported,
- reconnect after logout/login,
- #QA repeated attach/detach loop,
- script prepared: `scripts/run-k8s-attach-detach-loop.sh`,
- TestOps scenario prepared: `iscsi-p3-attach-detach-loop`,
- app writer pod replaced by reader pod on the same PVC,
- blockvolume restart and reattach once durable state is ready.
- Close bar:
- checksum passes through pod path,
- no session errors,
- cleanup leaves no iSCSI or K8s residue,
- product logs are enough to diagnose failures.
- QA/tooling:
- repeated attach/detach script exists:
`scripts/run-k8s-attach-detach-loop.sh`.
- TestOps registry entry exists:
`internal/testops/registry/iscsi-p3-attach-detach-loop.json`.
- default loop count comes from `SW_BLOCK_ATTACH_DETACH_ITERATIONS`.
- #QA status: PASS on M02, 3 iterations.
## Recently Closed Milestone: iSCSI-P4 CHAP / Access Control
- Goal:
- reach V2-level iSCSI auth behavior before any security-facing claim.
- Tasks:
- status: done in PR #41.
- target-side CHAP login negotiation:
- status: done in PR #41.
- direct LoginOp is rejected when CHAP is required,
- `AuthMethod=None` is rejected when CHAP is required,
- target emits CHAP MD5 challenge,
- correct username/response advances to LoginOp,
- wrong response fails closed,
- missing `CHAP_R` fails closed.
- `cmd/blockvolume` opt-in flags:
- status: done in PR #41.
- `--iscsi-chap-username`,
- `--iscsi-chap-secret`,
- flags require `--iscsi-listen`,
- username and secret must be set together.
- OS initiator CHAP smoke script:
- status: QA green.
- configure `iscsiadm` node auth before login,
- prove correct secret succeeds and wrong secret fails without residue.
- Kubernetes / CSI Secret integration:
- status: QA green on M02 at `9a1fe07`.
- CSI node consumes CHAP credentials from `NodeStageVolumeRequest.Secrets`,
- controller publish path must not copy CHAP secrets into `publish_context`,
- node configures `iscsiadm` CHAP settings after discovery and before login.
- launcher can render target-side CHAP env vars from a Kubernetes Secret,
- alpha runner can create the Secret and inject StorageClass
node-stage secret refs.
- replayed challenge rejected if supported by the protocol path,
- Close bar:
- unauthenticated access fails when CHAP is required,
- authenticated access succeeds,
- failed auth leaves no partial session/device state.
- QA/tooling:
- #QA assignment:
`internal/docs/qa-assignments/iscsi-p4-chap-lab-validation.md`.
- #QA assignment:
`internal/docs/qa-assignments/iscsi-p4-k8s-chap-validation.md`.
- #QA status:
- K8s CHAP dynamic PVC PASS on M02.
- default non-CHAP regression PASS on M02.
- V2 CHAP tests are the reference coverage inventory.
## Recently Closed Milestone: iSCSI-P5 CSI Node Lifecycle
- Goal:
- make kubelet retry/restart behavior safe enough for real clusters.
- Tasks:
- status: QA green on `iscsi/csi-node-lifecycle@4ee35c0`.
- local CSI node lifecycle guards:
- status: done in PR #41.
- NodeStage idempotency,
- mounted staging path must belong to the same volume,
- mounted staging path for another volume fails closed.
- NodeUnstage idempotency,
- unmounted staging path still logs out and removes local state.
- login failure cleanup,
- login failure does not record staged state.
- mkfs failure cleanup,
- already covered: successful login is logged out when mount fails.
- stale session detection,
- existing iSCSI login without staged volume identity fails closed,
- plugin restart may reuse an existing login only when `.volume` matches.
- plugin restart fallback,
- existing transport-file fallback covers unstage after restart.
- NodeStage restart identity is covered by `.volume`.
- repeated stage/unstage,
- local 3-cycle stage/unstage test leaves no staged state,
`.volume`, or `.transport`.
- wrong volume at staging path fails closed.
- #QA CSI node restart while PVC remains,
- script prepared: `scripts/run-k8s-csi-node-restart.sh`,
- TestOps scenario prepared: `iscsi-p5-csi-node-restart`,
- assignment: `internal/docs/qa-assignments/iscsi-p5-csi-node-lifecycle-validation.md`,
- status: QA PASS on M02.
- Close bar:
- kubelet retries do not wedge the node plugin,
- failed attach leaves no leaked device or session,
- repeated create/delete works without manual host cleanup.
- QA/tooling:
- #QA status: PASS on M02.
- manual kubelet poking is allowed only for first reproduction.
## Recently Closed Milestone: iSCSI-P6 ALUA / MPIO / Mounted Failover
- Goal:
- make mounted-volume failover a real frontend behavior instead of only a
reconnect story.
- Tasks:
- status: completed in PR #42 scope; QA green on
`iscsi/csi-node-lifecycle@d1025f1`.
- #design(iscsi-p6-alua-mpio-design) ALUA/MPIO policy and protocol shape:
- owner: dev.
- output: `internal/docs/ref/iscsi-p6-alua-mpio-design.md`.
- must be reviewed before changing protocol behavior.
- #design(iscsi-p6-qa-assignment) real initiator validation shape:
- owner: dev.
- output: `internal/docs/qa-assignments/iscsi-p6-alua-mpio-lab-validation.md`.
- must define the lab command, non-claims, and pass/fail criteria.
- V2 coverage alignment:
- status: design inventory added.
- do not copy V2 role/state ownership,
- do match V2 externally visible ALUA/MPIO protocol coverage unless V3
explicitly rejects a behavior.
- ALUA state model:
- status: local protocol slice done on `iscsi/csi-node-lifecycle`.
- active optimized,
- active non-optimized,
- standby,
- unavailable,
- transitioning.
- standby command policy:
- status: local protocol slice done; tightened by PR #42 review fix.
- metadata/path probing allowed,
- data READ, WRITE, and SYNCHRONIZE_CACHE fail closed on non-active
paths.
- standard INQUIRY TPGS discipline:
- status: local protocol slice done.
- TPGS stays off until REPORT TARGET PORT GROUPS and ALUA VPD identity
are implemented,
- when enabled, advertise implicit ALUA only unless explicit transitions
are implemented.
- REPORT TARGET PORT GROUPS:
- status: local protocol slice done.
- no-provider rejection,
- short allocation truncation,
- five-state reporting.
- VPD 0x83 target-port identity:
- status: local protocol slice done.
- NAA stable per volume,
- target port group and relative target port distinguish paths,
- short allocation length and no-ALUA branches tested.
- VPD 0x00 remains advertised-pages-equal-implemented-pages:
- status: local protocol slice done.
- state change while I/O is in flight:
- status: local protocol state-change test done.
- concurrent REPORT TARGET PORT GROUPS and standby write reject tests:
- status: done in PR #43.
- frontend state provider wiring:
- status: local P6-C slice done on `iscsi/csi-node-lifecycle`.
- connect ALUA provider to current V3 frontend facts without importing
authority or placement.
- mapping:
- frontend Healthy => active optimized,
- locally healthy but superseded/non-writable => standby,
- recovering => transitioning,
- idle supporting path => standby for metadata/path probing,
- degraded/identity mismatch => unavailable.
- path identity:
- NAA is stable per volume,
- target port group and relative target port are stable per
volume/replica path.
- multipath initiator test:
- status: QA green on `iscsi/csi-node-lifecycle@88e9301`.
- script: `scripts/run-iscsi-alua-os-smoke.sh`.
- script: `scripts/run-iscsi-alua-multipath-smoke.sh`.
- assignment: `internal/docs/qa-assignments/iscsi-p6-alua-mpio-lab-validation.md`.
- current claim: one active path reports ALUA through real Linux `sg_inq`
and `sg_rtpg`, then completes mkfs/mount/checksum/logout.
- current two-path claim: two iSCSI portals for one volume can be logged
in by Linux, report active/standby ALUA state, reject standby WRITE,
and appear as one logical device in `multipath -ll`.
- standby/probe session prerequisite: local P6-D slice implemented.
Non-active ALUA paths may use a borrowed metadata backend after
`Provider.Open` returns not-ready, so Linux can probe INQUIRY/VPD/RTPG
without allowing data I/O.
- #QA Test 1B PASS on M02:
- artifact:
`/mnt/smb/work/share/g15d-k8s/20260506T093732Z-iscsi-p6-alua-mpath-fix`.
- evidence: two iSCSI paths, common NAA, distinct TPG/RTP, r1
active/optimized, r2 standby, standby WRITE rejected, `multipath -ll`
grouped both paths under `mpatha`.
- non-claim: mounted workload failover still needs P6-E.
- primary failover while mounted:
- status: QA green on `iscsi/csi-node-lifecycle@d1025f1`.
- script: `scripts/run-iscsi-alua-mounted-failover-smoke.sh`.
- assignment: `internal/docs/qa-assignments/iscsi-p6-alua-mpio-lab-validation.md`.
- verified claim: mounted Linux multipath device can read a
pre-failover checksum and write a post-failover checksum after r1 is
killed and r2 reaches `Healthy=true` at a newer epoch.
- #QA Test 2 PASS on M02:
- artifact:
`/mnt/smb/work/share/g15d-k8s/20260506T094503Z-iscsi-p6-mounted-failover`.
- evidence: `/dev/mapper/mpatha` mounted, pre-failover checksum read
after failover, post-failover checksum written and verified, r2
promoted to `Epoch=2`, old r1 gate-rejected stale writes/syncs, no
active sessions or multipath residue after cleanup.
- old primary cannot serve stale successful I/O:
- status: QA green for killed-old-primary path on `d1025f1`.
- old-primary-return proof remains future soak/fault coverage, not required
for P6 alpha close.
- Close bar:
- real initiator sees correct ALUA/MPIO behavior,
- mounted workload survives or fails/reconnects according to documented
policy,
- byte-equal data proof after failover,
- no stale-primary success.
- QA/tooling:
- #QA active-path ALUA OS script is ready.
- #QA two-path multipath script is green on M02.
- #QA mounted multipath failover script is green on M02.
- do not rely on in-process protocol tests only.
## Recently Closed Milestone: iSCSI-P7 Performance And Backend Matrix
- Goal:
- make performance experiments comparable without turning early numbers into
product claims.
- Tasks:
- status: QA green on `iscsi/p7-performance-matrix-clean@6826139`.
- walstore baseline fio,
- smartwal fio behind explicit flag,
- Linux iSCSI loopback matrix,
- record fio summary and cleanup state.
- deferred:
- RoCE / 10.0.0.x lab path if available,
- 1GbE vs 25GbE comparison,
- pgbench scenario,
- CPU, memory, latency, and bandwidth sweep.
- script: `scripts/run-iscsi-backend-fio-matrix.sh`.
- assignment:
`internal/docs/qa-assignments/iscsi-p7-backend-fio-matrix-validation.md`.
- #QA PASS on M02:
- artifact:
`/mnt/smb/work/share/g15d-k8s/20260506T215457Z-iscsi-p7-backend-fio`.
- fio profile: 4 KiB randrw, psync, iodepth=1, size=128m,
runtime=60s.
- walstore: PASS, about 124 read IOPS / 124 write IOPS.
- smartwal: PASS, about 124 read IOPS / 125 write IOPS.
- cleanup: no active iSCSI sessions and no blockmaster/blockvolume
processes.
- non-claim: single-host loopback only, not a product performance claim.
- Close bar:
- same test runner scenario can compare backends,
- no silent backend switch,
- results are labelled experimental until SLOs exist.
- QA/tooling:
- #QA run the backend matrix on M02 first.
- #QA if RoCE is available, rerun with explicit 10.0.0.x portal path and
record the network path in the report.
- avoid manual benchmark notes without a repeatable scenario.
## Recently Closed Milestone: iSCSI-P8 Compatibility And Soak
- Goal:
- turn the current alpha iSCSI feature set into repeatable compatibility and
soak evidence without making performance claims.
- keep frontend protocol behavior stable while K8s and backend tests get
longer and more varied.
- Tasks:
- local ALUA concurrency guard:
- status: done on `iscsi/frontend-hardening`.
- cover concurrent REPORT TARGET PORT GROUPS while data READ/WRITE on a
standby path is rejected.
- closes the P6 pending item for concurrent RTPG plus standby reject.
- OS initiator soak:
- #QA green on `iscsi/frontend-hardening@38ff850`.
- repeat `run-iscsi-os-smoke.sh` with fio for a longer runtime.
- record session errors, fio summary, goroutine/process cleanup, and
final `iscsiadm -m session`.
- artifact:
`/mnt/smb/work/share/g15d-k8s/20260506T223240Z-iscsi-p8-soak-38ff850`.
- evidence:
- 2 iterations,
- 120s fio per iteration,
- `iscsiadm mkfs mount write/read logout` PASS,
- no active sessions after final cleanup.
- K8s CSI soak:
- #QA green on `iscsi/frontend-hardening@38ff850`.
- repeat attach/detach and fio paths with explicit iteration/runtime
values.
- record whether launcher owner-reference cleanup remains clean.
- evidence:
- `[alpha-fio] PASS`,
- `[attach-loop] PASS: 3 attach/detach app PVC cycles completed`,
- no sw-block PVC or deployment residue.
- compatibility matrix:
- #QA green for M02.
- document exact host distro, kernel, open-iscsi version, fio version,
and sg3-utils/multipath versions when used.
- add more hosts only when the first soak is repeatable.
- Close bar:
- local protocol concurrency tests green,
- one OS fio soak green,
- one K8s attach/detach or fio soak green,
- all runs leave no active sessions, mounts, multipath maps, or K8s residue.
- QA/tooling:
- prefer wrappers with env knobs over manual command sequences.
- label all runtime/throughput numbers as soak evidence, not benchmark
claims.
- #QA assignment:
`internal/docs/qa-assignments/iscsi-p8-compat-soak-validation.md`.
- #QA status:
- PASS on M02 at `38ff850`.
- final line:
`[iscsi-soak] PASS: compatibility soak completed`.
- non-claim:
compatibility probe only, not a long-running soak or performance claim.
## Recently Closed Milestone: TestOps For Frontend Lab Gates
- Goal:
- reduce false failures from manual multi-step lab runs by moving P8-style
gates into one TestOps entry point.
- keep existing shell scripts as the execution backend first; do not rewrite
all harness logic before the gate is stable.
- Tasks:
- #QA package P8 compatibility soak as a TestOps scenario:
- status: done; wrapper proven green in standalone runner and carried back
into the product planning flow.
- must record commit SHA, command, artifact root, step result, final line,
and cleanup status in a single result file.
- initial scenario may call `scripts/run-iscsi-compat-soak.sh`.
- pin alpha image build/import before K8s frontend gates:
- status: QA green at `c3a6e28`; workload composition hook active in this
branch.
- script: `scripts/build-alpha-images.sh`.
- TestOps scenario: `alpha-images-pin-build`.
- contract:
- build `sw-block:local` and `sw-block-csi:local`,
- optionally import both images into k3s containerd with
`SW_BLOCK_IMPORT_K3S=1`,
- record Docker image IDs,
- record `blockmaster`, `blockvolume`, and `blockcsi` `--version`
output,
- downstream K8s harnesses may consume the build output with
`SW_BLOCK_ALPHA_IMAGES_ENV=/path/to/pin-build/alpha-images.env`,
- fail before protocol smoke tests if build/import/version capture fails.
- composed TestOps workload scenarios:
- status: QA green at `cf9183a`.
- `nvme-p5-csi-dynamic`,
- `nvme-p5-default-iscsi-regression`.
- developer-owned P5 suite:
- status: QA green at `67592f2`.
- `scripts/testops-run-nvme-p5-suite.sh`,
- runs pin-build, then both P5 workload scenarios,
- passes `alpha-images.env` forward mechanically,
- writes one suite-level `result.json`.
- reason:
- NVMe-P5 showed that stale k3s images can mimic product protocol bugs.
The build/import step must be one reviewed gate, not manual lab memory.
- platform extraction target:
- status: seed shape extracted into standalone runner and native suite
flow; continue hardening in runner repo.
- port this V3 reference implementation into reusable runner primitives:
- `testops_pin_build` for build/import/version/image provenance,
- `consume_pin` for passing pinned outputs between phases,
- `assert_revision_matches` for component/runtime SHA checks,
- suite linkage that passes prior phase outputs without ad-hoc env-file
conventions.
- reference hardware evidence:
- `alpha-images-pin-build` PASS at `cf9183a`,
- `nvme-p5-csi-dynamic` PASS at `cf9183a`,
- `nvme-p5-default-iscsi-regression` PASS at `cf9183a`.
- runner-native protocol release suite:
- status: QA green on M02 at product `033028e` and runner `3c1b660`.
- suite: `testops/suites/protocol-release-gate.yaml`.
- command shape:
`swblock suite --results-dir <root> --env product_root=<remote-root>
--env ssh_key=<key> testops/suites/protocol-release-gate.yaml`.
- children:
- `iscsi-p6-alua-failover-chain`,
- `nvme-p4-multipath-failover-chain`,
- `nvme-p5-csi-protocol-chain`,
- `iscsi-p8-compat-soak-chain`.
- validation:
`swblock validate-bundle --profile protocol-release-gate <suite-run>`.
- define the minimal result contract:
- scenario name,
- repository SHA,
- host,
- step table,
- artifact paths,
- cleanup checks.
- keep product development unblocked:
- TestOps work should not change iSCSI protocol code.
- product branches can continue using scripts until TestOps reaches parity.
- Close bar:
- one command runs the P8 full lab gate,
- old-commit/stale-binary ambiguity is impossible or explicitly reported,
- result file is enough for review without reading raw terminal output.
- one runner-native command runs the full iSCSI/NVMe/CSI/soak release gate,
and `validate-bundle --profile protocol-release-gate` accepts the bundle.
- QA/tooling:
- Dev owns the core test content and uses TestOps as the primary dev loop.
- QA may run the same scenarios, add lab automation, and improve collection,
but should not be the only path that can execute a gate end-to-end.
- prefer small TestOps wrapper over a wholesale scenario DSL rewrite.
## Recently Closed Milestone: NVMe-oF / ANA Parity Planning
- Goal:
- bring NVMe-oF up to the same product discipline as the now-green iSCSI
frontend.
- treat V2 NVMe behavior as the feature floor, not code to copy blindly.
- understand the old high-performance path before touching protocol code.
- Reference:
- `internal/docs/ref/nvme-ana-parity-plan.md`.
- `internal/docs/ref/nvme-v2-coverage-gap-audit.md`.
- Tasks:
- NVMe-P0 audit:
- status: initial audit done; keep updating as code lands.
- compare V2 NVMe implementation and scenarios against current V3.
- classify every visible feature as present, missing, intentionally
deferred, or rejected with product reason.
- specifically answer whether the remembered "control API carries data"
path was standard NVMe/TCP in-capsule data or a custom V2 shortcut.
- initial answer: standard in-capsule data; no custom V2 vendor/admin data
command found in the NVMe package.
- NVMe-P1 OS kernel baseline:
- status: QA green on M02.
- script: `scripts/run-nvme-os-smoke.sh`.
- #QA assignment:
`internal/docs/qa-assignments/nvme-p1-os-smoke-validation.md`.
- #QA evidence:
- basic OS path PASS on M02,
- 60s fio PASS on M02,
- loopback 4 KiB fio used inline writes only,
- no test NQN or process residue after cleanup.
- build a repeatable `nvme connect -> mkfs -> mount -> fio/checksum ->
disconnect` script.
- dynamic ports only.
- no stale sessions or target processes.
- NVMe-P2 in-capsule / R2T performance path:
- status: QA green on M02 with host-specific classification.
- target now reports transport counters in `blockvolume.log` on close:
inline writes, R2T writes, H2C/C2H PDU counts, and read/write/flush
command counts.
- P1 observation: Linux `fio --bs=4k` used inline writes exclusively on
M02 (`r2t_writes=0`).
- P2 observation: Linux kernel 6.17.0-19 on M02 did not trigger R2T even
for `fio --bs=128k` or `dd bs=1M`; all writes were fragmented into
inline/in-capsule transfers.
- #QA assignment:
`internal/docs/qa-assignments/nvme-p2-inline-r2t-validation.md`.
- prove whether Linux uses inline data for small writes.
- run 128 KiB+ profiles to force or classify the R2T path.
- add visible counters or artifacts for inline vs R2T writes.
- follow-up:
- R2T requires a different initiator/profile or target-side test knob;
current M02 kernel behavior is not a product failure.
- compare iSCSI and NVMe only under labelled network/backend conditions.
- NVMe-P3 ANA identity and log page:
- status: QA green on M02 at `d330e89`.
- provider: `core/frontend/nvme.ANAProvider`.
- product wiring: `cmd/blockvolume` derives ANA state from the same
frontend projection used by iSCSI ALUA.
- log page: admin Get Log Page `0x0c` returns one ANA group when a
provider is configured.
- mapping:
- frontend Healthy => optimized,
- superseded healthy / idle supporting path => non-optimized,
- recovering => ANA change,
- degraded / identity mismatch => inaccessible.
- guard: Identify Controller / Namespace ANA fields remain zero without a
provider.
- P3-C behavior: with a provider, Identify Controller advertises ANA,
Identify Namespace carries the provider's ANA group, and Get Log Page ANA
reports the same group/state.
- OAES ANA Change Notice remains off; no async event producer exists yet.
- #QA assignment:
`internal/docs/qa-assignments/nvme-p3-ana-log-validation.md`.
- #QA evidence:
- ANA log `group_id=1`, `state=0x01`, `nsid=1`,
- Identify Controller `cmic=0x8`, `anagrpmax=1`, `nanagrpid=1`,
- Identify Namespace `anagrpid=1`,
- no `nvme_parse_ana_log` kernel warning,
- mkfs/mount/checksum PASS after ANA advertisement is enabled.
- NVMe-P4 multipath and mounted failover:
- status: fully QA green on M02 at `e1e0e0c`.
- #design:
`internal/docs/ref/nvme-p4-multipath-failover-design.md`.
- #QA assignment:
`internal/docs/qa-assignments/nvme-p4-multipath-lab-validation.md`.
- reach the iSCSI P6 bar for NVMe multipath.
- Test 1/2 discovery and native grouping:
- status: QA green on M02 at `a5ef1a5`.
- script: `scripts/run-nvme-multipath-smoke.sh`.
- evidence:
- run ID `20260507T161800Z-test`,
- two NVMe/TCP paths registered immediately,
- native Linux multipath exposed one namespace device,
- ANA log `group_id=1`, `state=0x01 optimized`, `nsid=1`,
- identity `nguid=24634c35194743419febbb18e06446be`,
`eui64=24634c3519474341`, `anagrpid=1`,
- final line:
`[nvme-mpath] PASS: two NVMe/TCP paths expose one ANA-aware namespace`.
- decision: single ANA group is sufficient for the current two-path
native multipath identity model.
- mounted failover:
- status: QA green on M02 at `e1e0e0c`.
- script: `scripts/run-nvme-mounted-failover-smoke.sh`.
- local guard:
- metadata-only standby NVMe path continues to reject I/O before
promotion,
- after ANA state becomes optimized, the same session can pass I/O to
the backend.
- #QA evidence:
- run ID `20260507T170000Z-nvme-p4-mounted-failover`,
- two TCP paths registered and Linux native multipath merged them to
`/dev/nvme1n1`,
- mounted ext4 workload survived active r1 kill,
- r2 promoted to `Epoch=2`, `AuthorityRole=primary`,
`FrontendPrimaryReady=true`,
- `pre.bin` checksum remained OK after failover,
- `post.bin` write/read/verify succeeded after failover,
- cleanup left no test NQN and no blockmaster/blockvolume process.
- NVMe-P5 CSI integration:
- status: QA green on `frontend/nvme-ana-parity-plan@8e0a28f`.
- latest QA:
- red at `622fae7`: StorageClass rendered `protocol: nvme`, but
lifecycle intent had no protocol and generated blockvolume still used
iSCSI args.
- red at `a1d5201`: live StorageClass carried both protocol keys, but
persisted lifecycle JSON still had no `protocol`; current source has
protocol on CSI/RPC/lifecycle, so the harness now gates component
`--version` output to catch stale K8s images before protocol checks.
- green at `69a1d20`: Test 1 NVMe dynamic PVC passed after rebuilt and
k3s-imported images; lifecycle persisted `protocol: "nvme"` and
launcher emitted NVMe args only.
- green at `8e0a28f`: Test 2 default iSCSI regression passed; all three
version gates matched HEAD, lifecycle persisted `protocol: "iscsi"`,
generated manifest used iSCSI args only, and cleanup left no iSCSI or
NVMe residue.
- current fix: prefer product-scoped
`sw-block.seaweedfs.com/protocol`, keep `protocol` as compatibility,
delete stale cluster-scoped StorageClass before apply, capture
`storageclass.live.yaml`, and record `--version` for blockmaster,
blockcsi, and generated blockvolume before judging launcher output.
- allow StorageClass protocol selection without changing the app.
- default StorageClass path stays iSCSI.
- `parameters.sw-block.seaweedfs.com/protocol: nvme` selects NVMe target
facts end-to-end:
- CSI CreateVolume records protocol in lifecycle intent,
- master lifecycle RPC carries protocol,
- launcher renders `blockvolume` with `--nvme-listen`,
`--nvme-subsysnqn`, and `--nvme-ns`,
- CSI ControllerPublish returns `protocol=nvme`, `nvmeAddr`, and `nqn`,
- CSI NodeStage uses `nvme connect`, formats/mounts the NVMe namespace,
and disconnects by NQN on NodeUnstage.
- K8s harness:
- script: `scripts/run-k8s-alpha-nvme.sh`,
- underlying env knob: `SW_BLOCK_FRONTEND_PROTOCOL=nvme`,
- dynamic PVC/app manifest remains unchanged except injected
StorageClass parameter.
- #QA assignment:
`internal/docs/qa-assignments/nvme-p5-csi-protocol-selection-validation.md`.
- platform lesson:
- stale k3s images cost multiple lab rounds; TestOps pin-build/import
should make build, k3s image import, digest capture, and component
version verification one required step for future release gates.
- NVMe-P6 RoCE / network performance matrix:
- status: deferred to future network/performance plan.
- correctness gates are green; RoCE is no longer part of protocol
readiness closure.
- Close bar for the planning slice:
- audit table exists,
- next code task has a red test or lab reproduction,
- no ANA or performance claim is enabled before matching host evidence.
- QA/tooling:
- protocol assignments remain as historical evidence under
`internal/docs/qa-assignments/`.
- future protocol changes should update the runner-native release gate rather
than adding manual-only QA instructions.
## Current Active Milestone: V2 Parity And Hardening Backlog
- Goal:
- keep iSCSI/NVMe protocol readiness protected by the release gate while
moving active development to remaining V2 parity, product hardening, and
TestOps platform work.
- Work buckets:
- V2 parity audit:
- compare the old `weed/storage/blockvol` scenario corpus against current
V3 capabilities,
- classify each gap as already covered by the release gate, still missing,
intentionally deferred, or rejected with product reason.
- availability/recovery hardening:
- replica return and reintegration,
- RF2/RF3 rebuild and failover matrices,
- WAL retention and flow-control pressure,
- longer soak and failure-injection runs.
- Kubernetes/operator hardening:
- durable blockvolume state beyond throwaway alpha defaults,
- operator/controller lifecycle,
- multi-node attach and non-loopback frontend addressing.
- TestOps platform:
- keep product-owned scenarios in this repo,
- move repeated primitives into the standalone runner,
- use native suite/run-control/validate-bundle for release evidence,
- explore controller/agent mode separately from the open SSH runner path.
- Close bar for the next planning slice:
- a V2 parity matrix exists with explicit disposition per feature/scenario,
- at least one non-protocol hardening gate is runner-native and repeatable,
- protocol release gate remains green after unrelated hardening changes.
## Cross-Cutting Technical Rules
- Protocol code must not decide authority.
- Protocol code must not decide replica readiness.
- CSI must consume frontend facts, not infer storage truth.
- Placement intent is not authority.
- Authority movement is not data continuity.
- Best-effort ACK is not full durability.
- If V2 behavior is copied, copy the test expectation first and adapt the code
to V3 boundaries.
## QA / TestOps Rules
- Prefer scripts or TestOps scenarios over manual command sequences.
- Manual testing is allowed for first reproduction, but convert the result into
a repeatable script or scenario.
- Keep default `go test` focused on unit/component coverage.
- Local binary wiring tests that build product binaries, spawn
`blockmaster`/`blockvolume`, and use loopback protocol clients must use the
explicit `subprocess` build tag. These are not m01/m02 lab integration tests.
- Linux OS/K8s/lab tests that use `iscsiadm`, `nvme-cli`, kernel initiators,
mounts, `sudo`, or m01/m02 cleanup state belong in runner-native TestOps
scenarios, not default `go test` and not the local `subprocess` tag.
- When a subprocess or runner integration test fails, first ask whether its
assertion can be moved down to a component seam such as authority, engine
projection, frontend protocol adapter, lifecycle rendering, or
ready-assignment handling. Keep only binary wiring, real OS frontend I/O,
process lifecycle, and lab cleanup in the runner layer.
- QA report must include:
- branch and commit,
- command,
- lab host,
- result,
- artifact path,
- cleanup state,
- exact log line for any failure.
## PR Cadence
- Use milestone PRs, not one PR per tiny fix.
- Target one or two PRs per day at most.
- For the current active milestone, keep parity matrix updates, non-protocol
hardening gates, and runner scenario changes grouped by reviewable outcome.
- Split OS/K8s harness work only if it becomes too large to review cleanly.
## Finish Action
- When a milestone closes, move the finished plan and related references into a
dedicated directory, for example `internal/docs/finished/iscsi-p2/`.
- Keep `current-plan.md` focused on the next active milestone.
@@ -0,0 +1,75 @@
# Finished Plan: Beta Hardening Seed Gate
Status: historical reference. Closed on 2026-05-11 by the runner-native
`beta-hardening-gate` suite.
This phase turned the protocol-ready block product into a beta-hardening seed:
one runner-native suite covering iSCSI, NVMe, CSI protocol selection, soak,
component lifecycle, restart, returned-replica evidence, diagnostics, and
cleanup residue.
Current work is tracked in `../current-plan.md`.
## Close Evidence
QA validated the first full green run:
- suite: `testops/suites/beta-hardening-gate.yaml`
- run id: `20260511-031605-8258`
- product commit: `8822f20e91c2b88727ead9e49f9bf75eec28c791`
- runner commit: `cf65daaf2ce5cf500e1efa48b411f7cb66dbac0b`
- result: PASS
- wall clock: 1305.86 seconds
- `swblock validate-bundle --profile beta-hardening --expect-commit 8822f20`
returned VALID.
All 10 children passed:
1. `iscsi-p6-alua-failover`
2. `nvme-p4-multipath-failover`
3. `nvme-p5-csi-protocol`
4. `iscsi-p8-compat-soak`
5. `csi-lifecycle-component`
6. `csi-rf1-durable-restart`
7. `operations-status-diagnostics`
8. `returned-replica-component`
9. `iscsi-returned-replica`
10. `cleanup-residue`
## What Closed
- iSCSI/NVMe/CSI protocol readiness is now included in a broader beta seed
gate.
- Returned-replica evidence is field-level and defensible:
- returned r1 remains non-primary and frontend-fenced,
- r1 local recovery frontier is captured,
- r2 remains primary and durable operational at epoch >= 2,
- r2 sees r1 as a healthy peer.
- Component/operations chains now emit product provenance evidence, so suite
provenance is not inferred from the controller checkout.
- Runner suite provenance now derives `product_commit` from child evidence and
fails on mixed or missing child evidence after the suite commit is
established.
- `runner_commit` is captured from Go build metadata, not from the caller's
current working directory.
- Cleanup residue is a real suite child and validates no stale iSCSI/NVMe/V3/K8s
residue at the end of the run.
## Important Non-Claims
- This is not production HA.
- This is not broad distro or kernel compatibility.
- This is not performance readiness.
- This is not a multi-node/cloud-scale claim.
- This is not an operations/operator completeness claim.
- This is one full green, not yet a back-to-back repeatability claim.
## Follow-Up Decisions
- Request one back-to-back QA run before calling the beta seed suite stable.
- Keep `protocol-release-gate` as the smaller periodic frontend regression
suite.
- Use `beta-hardening-gate` for milestone readiness, not default developer
iteration.
- Reduce future suite cost by lowering integration-only assertions into
component/contract tests whenever possible.
@@ -0,0 +1,98 @@
# Finished Plan: Beta Seed Stabilization And Cost Reduction
Status: historical reference. Closed on 2026-05-11 by two back-to-back
`beta-hardening-gate` PASS runs on real hardware.
This phase turned the first green beta-hardening seed suite into a repeatable
milestone gate and produced the first cost-reduction targets for the next
iteration.
Current work is tracked in `../current-plan.md`.
## Close Evidence
The repeatability claim is tied to this exact product/runner pair:
- Product commit:
`8822f20e91c2b88727ead9e49f9bf75eec28c791`
- Runner commit:
`cf65daaf2ce5cf500e1efa48b411f7cb66dbac0b`
- Suite:
`testops/suites/beta-hardening-gate.yaml`
- Validator:
`swblock validate-bundle --profile beta-hardening --expect-commit 8822f20`
Back-to-back QA runs:
| Run | Run ID | Result | Children | Wall Clock | Bundle Validation |
| --- | --- | --- | --- | ---: | --- |
| 1 | `20260511-031605-8258` | PASS | 10/10 | `21m46s` | VALID |
| 2 | `20260511-040412-ac38` | PASS | 10/10 | `22m55s` | VALID |
No manual cleanup was performed between runs. The second run's pre-clean and
the final `cleanup-residue` child both passed. QA reported no residue after the
second run.
## Delivery Gate Result
All close criteria passed:
1. `beta-hardening-gate` passed twice back-to-back without manual cleanup.
2. The second bundle validated with `--profile beta-hardening`.
3. Both runs recorded the same product commit and runner commit.
4. The final `cleanup-residue` child passed.
5. No repeatability failure required a scoped product follow-up.
6. The beta suite cost map was documented with concrete componentization
targets.
## Cost Map
Reference: `../ref/beta-hardening-suite-cost-map.md`.
The first green suite cost was `1305.86s` (`21m46s`). Top drivers:
| Child | Wall Clock | Share | Decision |
| --- | ---: | ---: | --- |
| `iscsi-p8-compat-soak` | `659s` | `50.5%` | Keep as release/periodic soak. |
| `nvme-p5-csi-protocol` | `273s` | `20.9%` | Keep K8s proof; lower protocol-shape checks. |
| `csi-rf1-durable-restart` | `165s` | `12.6%` | Keep K8s restart proof; lower script/render/status checks. |
| `nvme-p4-multipath-failover` | `138s` | `10.6%` | Keep kernel multipath proof. |
Follow-up work already seeded after this repeatability baseline:
- `testops/scenarios/nvme-p5-protocol-component-gate.yaml`
- `testops/scenarios/csi-rf1-durable-restart-component-gate.yaml`
Those commits are forward work after the repeatability claim. They do not alter
the historical `8822f20` beta milestone evidence.
## What Closed
- `beta-hardening-gate` is now a repeatable milestone readiness suite.
- The suite's provenance is defensible:
- product commit comes from child evidence,
- runner commit comes from Go build metadata,
- missing or mixed child product evidence fails the suite.
- The suite has a final cleanup-residue child and no longer relies on implicit
operator cleanup.
- Cost-reduction targets are explicit enough to drive the next active plan.
## Important Non-Claims
- This is not production HA.
- This is not broad distro or kernel compatibility.
- This is not performance readiness.
- This is not an operator.
- This is not a cloud-scale or multi-node AWS claim.
- This does not replace user feedback or an iterative release program.
## Follow-Up Decisions
- Keep `beta-hardening-gate` as the milestone suite.
- Keep `protocol-release-gate` as the smaller frontend protocol regression
suite.
- Do not use the 20-23 minute beta suite as the default developer loop.
- Promote fast component gates for known protocol/lifecycle shape contracts.
- Start operations-layer work from contracts and diagnostics before operator
implementation.
@@ -0,0 +1,85 @@
# Finished Plan: Fast Gates And Operations Contract Prep
Status: historical reference. Closed on 2026-05-11 after the fast gates and the
first operations status report contract were validated on m02.
This phase turned the repeatable beta milestone suite into a more practical
developer workflow and seeded the operations layer with a read-only volume
status report contract.
This report is observability evidence. It is not a block/data snapshot.
Current work is tracked in `../current-plan.md`.
## Close Evidence
Baseline milestone evidence inherited from phase 3:
- `beta-hardening-gate` run 1:
`20260511-031605-8258`, PASS, 10/10, `21m46s`, bundle VALID.
- `beta-hardening-gate` run 2:
`20260511-040412-ac38`, PASS, 10/10, `22m55s`, bundle VALID.
- Product commit for that repeatability claim:
`8822f20e91c2b88727ead9e49f9bf75eec28c791`.
- Runner commit for that repeatability claim:
`cf65daaf2ce5cf500e1efa48b411f7cb66dbac0b`.
Fast gate validation:
| Gate | Run ID | Product Commit | Result | Wall Clock | Bundle |
| --- | --- | --- | --- | ---: | --- |
| `nvme-p5-protocol-component-gate` | `20260510-214940-d726` | `b926b7e50c522665b66a81a2990a3fe925364365` | PASS | `1.486s` | collected |
| `csi-rf1-durable-restart-component-gate` | `20260510-214947-206b` | `b926b7e50c522665b66a81a2990a3fe925364365` | PASS | `1.034s` | collected |
| `operations-volume-status-report-component-gate` | `20260510-232649-03fd` | `c8a27ac4ca35e4686420ce068bb67811b9a95fd9` | PASS | `1.081s` | collected |
The operations gate was initially named
`operations-volume-status-snapshot-component-gate`. It was renamed to
`status-report` and revalidated to avoid conflict with real block/data snapshot
terminology.
All three fast gates passed `swblock validate`.
## What Closed
1. Developers now have runner-native component gates for:
- CSI/NVMe/iSCSI protocol propagation,
- RF=1 durable restart contract shape,
- the first operations volume status report contract.
2. `testops/README.md` documents which gate to run:
- package-local `go test`,
- fast runner-native component gate,
- child integration chain,
- full beta milestone suite.
3. The full `beta-hardening-gate` remains a milestone/release gate, not the
default debugging loop.
4. The first operations contract is documented at
`../ref/operations-volume-status-report-contract.md`.
5. `core/ops.BuildVolumeStatusReport` assembles the report from existing
read-only facts:
- master `StatusResponse` frontend targets,
- local `StatusProjection`,
- replication peer status,
- durable volume status,
- synthetic residue inputs.
6. A reviewer caught the valid `lun:0` omission risk; JSON-level tests now keep
zero-valued frontend identity fields visible.
## Important Non-Claims
- This phase does not deliver a block/data snapshot.
- This phase does not deliver an operator.
- This phase does not add force-detach or cleanup commands.
- This phase does not claim production HA.
- This phase does not change the beta milestone suite.
- The operations status report is read-only evidence, not authority or a
mutation precondition by itself.
## Follow-Up Decisions
- Move from pure status-report builder to a read-only collection surface.
- Keep the current direct DTO imports acceptable for the seed, but consider a
thinner schema/input DTO boundary if the operations package grows.
- Continue lowering expensive suite assertions into fast component gates when
failures are concrete and componentizable.
- Reserve QA for long suite repeatability, trust-critical validation, and
ambiguous lab behavior.
@@ -0,0 +1,77 @@
# Finished Plan: Read-Only Operations Status Report Integration
Status: historical reference. Closed on 2026-05-11 after the read-only
operations status report collector, schema gate, artifact gate, returned-replica
case, and operator-facing guide were validated.
This phase turned the first operations-layer status report from a seed builder
into a small read-only evidence surface. It is observability evidence only. It
is not a V2-style block/data snapshot, clone, backup, rollback point, restore
feature, operator, force-detach protocol, or cleanup authorization.
Current work is tracked in `../current-plan.md`.
## Goal
Make one stable report answer:
```text
What volume/replica is this host serving, what role does it believe it has,
what frontend facts are exposed, what durable lineage is latched, what peers
are known, and what residue would make a cleanup or failover decision unsafe?
```
## Close Evidence
| Gate | Run ID | Product Commit | Result | Wall Clock | Notes |
| --- | --- | --- | --- | ---: | --- |
| `operations-volume-status-report-component-gate` | `20260510-232649-03fd` | `c8a27ac4ca35e4686420ce068bb67811b9a95fd9` | PASS | `1.081s` | baseline builder gate |
| same | `20260510-233106-cfb9` | `569855f` | PASS | `1.201s` | collected `volume-status-report.json` |
| same | `20260511-000155-b27d` | `171d872` | PASS | `1.226s` | schema-shape pinning |
| same | `20260511-001715-9921` | `c18489e` | PASS | `1.288s` | read-only collector seam |
| same | `20260511-002427-09ff` | `be45263` | PASS | `1.368s` | returned replica durable-ready/frontend-fenced case |
All 13 runner scenario YAML files validated after the schema/collector changes.
## What Closed
1. `core/ops.BuildVolumeStatusReport` assembles schema version `1.0` from
existing status facts.
2. `VolumeStatusReportCollector` provides an injectable read-only seam for:
- master status,
- local status projection,
- peer status,
- durable status,
- residue,
- product/runner provenance.
3. Collector errors return a partial report plus joined source errors, so useful
evidence is preserved without hiding failed source collection.
4. The fast runner-native gate writes and collects `volume-status-report.json`.
5. JSON shape tests pin operator-facing keys and keep valid zero-valued frontend
identity fields such as `lun:0`.
6. Returned/non-primary replica status is covered: durable lineage can be
latched and operational while the replica remains frontend-fenced.
7. `ref/operations-volume-status-report-operator-guide.md` documents what an
operator may inspect and what must not be inferred.
## Important Non-Claims
- This phase does not deliver a block/data snapshot.
- This phase does not deliver an operator.
- This phase does not add force-detach, cleanup, promote, demote, or restart
controls.
- This phase does not claim HA.
- This phase does not change `beta-hardening-gate`.
- This phase does not introduce a public unauthenticated operations API.
- A stale report is stale evidence, not current truth.
## Follow-Up Decisions
- Keep `core/ops` direct imports of product DTOs acceptable for this seed.
Revisit a thinner ops-owned input DTO only if the package grows or DTO churn
starts leaking into the schema.
- Future admin controls must be separate mini-protocols with fencing and
authority semantics. They must not reuse this report as authorization.
- Continue moving concrete expensive-suite assertions into fast component gates
when the failure can be isolated without a live lab.
@@ -0,0 +1,170 @@
# Finished Plan: iSCSI OS-Initiator Compatibility
Status: historical reference. Closed on 2026-05-11 after both Linux/open-iscsi
and Windows built-in iSCSI Initiator validation passed.
Current work remains tracked in `../current-plan.md`.
## Goal
Prove V3 iSCSI can survive real OS initiators doing normal filesystem work,
not just in-process protocol clients:
```text
discover/login -> block device -> mkfs/format -> mount -> write/read verify
-> stress I/O -> disconnect -> no residue
```
This plan closes only OS-initiator compatibility. It does not claim
performance, HA, MPIO, broad distro coverage, multi-node Kubernetes attach,
upgrade safety, or production readiness.
## Current Close State
| Gate | Status | Evidence |
| --- | --- | --- |
| Linux open-iscsi OS initiator | PASS | `iscsi-os-initiator-compat-chain`, run `20260511-014714-eca5`, product `9e8ffab` |
| Windows built-in iSCSI Initiator | PASS | Target artifact `/mnt/smb/work/share/g15d-k8s/20260511T085158Z-iscsi-windows-target/`, product `9e8ffab` |
| External target hold mode | PASS | m02 target-only startup emitted `target-ready.env` at product `9e8ffab` |
| V2 comparison decision | Done | No broad V2 port while Linux OS gate is green; future failures reduce to focused component tests |
## Linux Evidence
Runner-native gate:
```text
swblock run testops/scenarios/iscsi-os-initiator-compat-chain.yaml
```
Latest green:
- Run ID: `20260511-014714-eca5`.
- Product commit: `9e8ffab`.
- Result: `PASS`, `22/22` actions, `1m13s`.
- Host: m02 Linux/open-iscsi.
- Target size: 65,536 x 4 KiB blocks, 256 MiB.
- Workload:
- `iscsiadm` discovery/login,
- kernel block device materialization,
- `mkfs.ext4`,
- mount,
- random payload write/read checksum,
- `fio` randrw for 60 seconds,
- logout and node cleanup.
Artifact claims:
- `run.log`: final `[iscsi-os] PASS`.
- `mkfs.iter1.log`: ext4 format completed.
- `sha256-check.iter1.log`: payload checksum OK.
- `fio.iter1.log`: `err= 0`.
- `iscsi-sessions.after.txt`: `iscsiadm: No active sessions.`
- process assertions: no `blockmaster` or `blockvolume` residue.
- `dmesg.new.txt`: attach, mount, unmount, cache sync, ALUA detach only; no
`DID_BAD_TARGET`, `I/O error`, `Buffer I/O`, or rejecting I/O.
## Windows Evidence
QA result: PASS.
Environment:
- Product commit on m02: `9e8ffab`.
- Windows host: Windows 11 Pro (`PING-R13`).
- m02 kernel: `6.17.0-19-generic`, Ubuntu 24.04.3 LTS.
- Target artifact:
`/mnt/smb/work/share/g15d-k8s/20260511T085158Z-iscsi-windows-target/`.
Validation shape:
- Held a V3 iSCSI target on m02 in target-only mode.
- Kept the target loopback-only.
- Used SSH local port-forward from Windows to m02.
- Used Windows built-in iSCSI Initiator to discover/connect.
- Initialized/formatted NTFS.
- Wrote, copied, and read back a 4 MiB payload with byte-exact checksum.
- Disconnected and verified no session/process residue.
Evidence:
- `run.log`: target-only mode, portal `127.0.0.1:36260`, hold complete,
cleanup.
- `target-ready.env`: `SW_BLOCK_ISCSI_TARGET_READY=1`, IQN, portal.
- `blockvolume.log`: iSCSI listener and per-LBA durable write dispatches during
NTFS journal and payload/copy writes.
- Windows: target IQN discovered; connect succeeded with `IsConnected=True`,
`NumberOfConnections=1`.
- Windows: exactly one new iSCSI disk online.
- Windows: NTFS format succeeded, 240 MiB on `S:`.
- Windows: 4 MiB write/copy/read checksum matched.
- Windows: disconnect succeeded; `Get-IscsiSession` empty after cleanup.
- m02: target self-exited at hold window; no lingering `blockmaster` or
`blockvolume`.
Claim:
```text
Windows 11 Pro built-in iSCSI Initiator can discover, connect to, format NTFS,
write/read with byte-exact checksum, and cleanly disconnect from a V3 iSCSI
target at commit 9e8ffab over an SSH local-forward tunnel to a loopback-bound
m02 target.
```
QA found two documentation portability issues and the assignment was corrected:
- PowerShell 5.1 lacks static `RandomNumberGenerator.Fill`; use
`RNGCryptoServiceProvider.GetBytes`.
- `Remove-IscsiTargetPortal -TargetPortalPortNumber` needs a `[UInt16]` cast on
PowerShell 5.1.
## Harness Changes
Added runner scenario:
- `testops/scenarios/iscsi-os-initiator-compat-chain.yaml`
Added script support in `scripts/run-iscsi-os-smoke.sh`:
- timestamp-based dmesg delta gate,
- target-only hold mode for external initiators,
- loopback/external initiator portal separation,
- machine-readable `target-ready.env`.
Important security behavior:
- `blockvolume` still rejects unauthenticated non-loopback iSCSI binds.
- Windows validation uses SSH tunneling instead of weakening that product
guard.
## V2 Comparison Decision
The V2 audit remains useful as a coverage inventory, but this plan does not
port broader V2 session architecture.
Reason:
- The Linux OS-initiator gate is green.
- Historical V2 deltas relevant to the original failure are already covered in
V3 or tracked as future component stress coverage:
- Data-Out collection,
- bounded pending queue,
- Data-Out timeout,
- multi-PDU Data-In.
Future rule:
```text
If Windows or soak fails, reduce the first failure to a focused component or
protocol test before changing the long runner gate.
```
## Non-Claims
- No performance benchmark.
- No production HA.
- No MPIO.
- No CHAP claim from this plan.
- No NVMe claim.
- No multi-node Kubernetes claim.
- No broad distro or Windows Server matrix.
- No operator lifecycle claim.
@@ -0,0 +1,179 @@
# Finished Plan: iSCSI Session And Backend Pressure Hardening
Status: historical reference. Closed on 2026-05-11 after fast protocol
pressure coverage, product-backed L2 durable restart coverage, review
hardening, and one Linux/open-iscsi milestone gate passed at commit `a0550be`.
Current work remains tracked in `../current-plan.md`.
## Goal
Harden the iSCSI frontend behind the now-green Linux and Windows OS initiator
gates by moving remaining risk into fast component and L2 tests first.
This plan deliberately avoided starting with another long m02 integration loop.
The rule was:
```text
component first -> product-backed gate only when the component boundary is green
```
## Close State
| Gate | Status | Evidence |
| --- | --- | --- |
| Fast iSCSI protocol pressure pack | PASS | `go test ./core/frontend/iscsi -run 'TestP2_ISCSI\|TestP1_ISCSI\|TestDataInWriter\|TestDataOut' -count=1`, `0.466s` |
| Product-backed durable restart L2 pack | PASS | `go test -tags subprocess ./cmd/blockvolume -run 'TestISCSI_L2Durable(RestartReconnect_(PreservesData\|RepeatedCycles)\|SyncCacheRestart_AcceptsSyncAndPreservesWrites)' -count=1 -v`, `64.151s` |
| Internal review | PASS | Reviewer found no blocking issues after readiness/test-claim fixes |
| Linux open-iscsi milestone gate | PASS | `iscsi-os-initiator-compat-chain`, run `20260511-091432-d7f6`, `22/22` actions, `1m13s`, product `a0550be` |
Milestone bundle:
```text
V:/share/g15d-k8s/testops-runs/iscsi-pressure-close/20260511-091432-d7f6
```
Remote product checkout used for the milestone gate:
```text
/tmp/seaweed-block-plan-roadmap-refresh-devrun
commit a0550be6a2fc02a4b33b76152d0deb47a5d8cef9
```
## Delivered Tests
### Durable Restart Reconnect
Added:
```text
TestISCSI_L2DurableRestartReconnect_PreservesData
```
Shape:
- start single-slot `blockmaster`,
- start `blockvolume` with `--durable-root`, `walstore`, and iSCSI,
- write one 4 KiB block through an iSCSI session,
- stop `blockvolume`,
- restart `blockvolume` with the same durable root and same iSCSI address,
- reconnect over iSCSI and read the same LBA,
- assert byte equality.
This pins the smallest product-backed restart/reconnect path without
Kubernetes or an OS initiator.
### Repeated Durable Reconnect Cycles
Added:
```text
TestISCSI_L2DurableRestartReconnect_RepeatedCycles
```
Shape:
- start the same single-slot product stack,
- write a distinct 4 KiB LBA in each cycle,
- read all prior LBAs,
- logout,
- restart `blockvolume` with the same durable root and iSCSI address,
- repeat for three cycles,
- final reconnect verifies every written LBA.
This turns one restart into a short pressure loop and catches durable-root or
session cleanup regressions that a single cycle can miss.
### Sync Cache Acceptance With Durable Restart
Added:
```text
TestISCSI_L2DurableSyncCacheRestart_AcceptsSyncAndPreservesWrites
```
Shape:
- start the same single-slot product stack,
- write 12 distinct 4 KiB LBAs through iSCSI,
- issue `SYNCHRONIZE CACHE(10)` every four writes plus a final sync,
- stop `blockvolume`,
- restart with the same durable root and iSCSI address,
- reconnect and verify all written LBAs.
Helper added:
```text
g8IscsiClient.syncCache10
```
Important claim boundary: this test proves the product iSCSI stack accepts
`SYNCHRONIZE CACHE(10)` and preserves acknowledged writes across a clean durable
restart. It is not crash, FUA, or power-loss durability evidence.
## Review Fixes
Internal review caught test-quality issues before close. The final commit
addressed them:
- Added explicit iSCSI listener readiness polling after product status reports
the replica healthy. Status readiness alone is not a TCP/listener contract.
- Hardened single-slot master startup parsing with a ready-line timeout and
read-error check.
- Narrowed the Sync Cache test name and plan wording to avoid overclaiming
crash durability.
- Expanded restart verification from representative LBAs to all 12 written
LBAs.
## Milestone Gate
Runner-native gate:
```text
swblock run --results-dir V:/share/g15d-k8s/testops-runs/iscsi-pressure-close \
--env product_root=/tmp/seaweed-block-plan-roadmap-refresh-devrun \
--env ssh_key=C:/work/dev_server/testdev_key \
testops/scenarios/iscsi-os-initiator-compat-chain.yaml
```
Result:
```text
=== iscsi-os-initiator-compat-chain === PASS (1m13.531s)
22 actions: 22 passed, 0 failed
run bundle: V:\share\g15d-k8s\testops-runs\iscsi-pressure-close\20260511-091432-d7f6
```
The milestone gate re-proves the real Linux kernel initiator path after the
fast/L2 gates:
- `iscsiadm` discovery/login,
- ext4 format,
- mount,
- payload write/read checksum,
- `fio` stress with `err= 0`,
- logout,
- no active iSCSI sessions,
- no blockmaster/blockvolume process residue,
- dmesg delta gate clean.
## What This Adds To The Roadmap
This phase sits between protocol credibility and beta release gates:
- It keeps iSCSI debugging mostly in fast local/component/L2 loops.
- It adds product-backed durable restart evidence without Kubernetes.
- It keeps OS initiator and beta suites as milestone evidence, not the first
debugging loop.
- It provides a pattern for future pressure hardening: narrow component test,
product-backed L2 confirmation, then one milestone gate.
## Non-Claims
- Not performance evidence.
- Not HA or multi-replica failover evidence.
- Not MPIO evidence.
- Not broad OS matrix evidence.
- Not Kubernetes operator cleanup evidence.
- Not crash, FUA, or power-loss durability evidence.
- Not a replacement for beta-hardening suite validation.
@@ -50,7 +50,7 @@ Non-promise for the current alpha:
| App-facing demo | Users can see normal pods using a PVC, not only storage internals. | Done. |
| Clean teardown | Smoke leaves no iSCSI sessions and no visible K8s resources. | Mostly done; generated workload cleanup still harness-assisted. |
| Public docs | Users understand architecture, roadmap, and non-claims. | In progress. |
| OS initiator compatibility | Linux/Windows iSCSI should survive real mkfs/format-sized writes. | Active hardening. |
| OS initiator compatibility | Linux/Windows iSCSI should survive real mkfs/format-sized writes. | Closed for Linux + Windows single-host validation. |
### Required For Beta
@@ -78,7 +78,7 @@ Priority definitions:
|---|---|---|---|
| README quick start fresh-user pass | First impression. | Done | Final close run: `20260504T000127Z`. |
| App PVC demo | Explains value to K8s users. | Done | `scripts/run-alpha-app-demo.sh`, `docs/kubernetes-app-demo.md`. |
| iSCSI large write / mkfs compatibility | Windows/Linux format failure kills demos. | Active | `frontend: chunk iSCSI R2T writes by MaxBurst`; needs OS retest. |
| iSCSI large write / mkfs compatibility | Windows/Linux format failure kills demos. | Closed for current alpha claim | Linux runner-native gate passes with mkfs, mount, checksum, fio, cleanup, and clean dmesg delta. Windows 11 built-in Initiator validated NTFS format and 4 MiB checksum over SSH tunnel. |
| Remove misleading internal labels from public docs/comments | Open-source readers should not see internal phase jargon. | Active | Keep public docs free of internal gate names. |
| Branch/PR discipline after MVP merge | Product fixes need reviewable slices. | Active | New product fixes should use branch + PR. |
@@ -147,22 +147,21 @@ Default answer to #7 is yes for all product fixes after the MVP merge.
## Current Immediate Recommendation
Do not start new feature work until the iSCSI OS-initiator compatibility issue
is verified.
The iSCSI OS-initiator compatibility issue is closed for the current alpha
claim.
The next concrete product step is:
```text
Run a real Linux/Windows initiator against a meaningful volume size.
mkfs/format it.
Write/read data.
Confirm no DID_BAD_TARGET / I/O error.
Move remaining iSCSI work to component-first session/backend pressure tests and
keep long OS-initiator runs as milestone gates.
```
If it fails, keep the work in an iSCSI compatibility branch and port the missing
V2 execution pieces with tests:
Current state:
- multi Data-In read splitting,
- CmdSN window and pending queue,
- Data-Out timeout,
- additional mkfs/fio regression scenarios.
- Linux/open-iscsi gate is green at product commit `9e8ffab`.
- Windows 11 built-in Initiator validation is green at product commit
`9e8ffab`.
- V2 execution deltas are not reopened while the OS gates are green.
- Future failures should be reduced to fast component/protocol tests before
adding more long integration loops.
+51 -22
View File
@@ -7,22 +7,25 @@ This is the short internal roadmap. Keep it current and readable.
- Build a small Kubernetes block storage service that is easier to try and
reason about than a large distributed-storage stack.
- Target early users running lab or small Kubernetes clusters.
- Keep alpha claims narrow: dynamic PVC, iSCSI path, app write/read, clean
teardown.
- CHAP is implemented for target-side iSCSI and CSI node staging, with lab
validation. Do not claim production HA, seamless mounted failover,
performance, multipath, or NVMe-oF readiness until separately tested.
- Keep alpha/beta claims narrow: dynamic PVC, iSCSI/NVMe protocol-gated paths,
app write/read, clean teardown, and explicit non-claims.
- CHAP, iSCSI ALUA, NVMe ANA, CSI protocol selection, and mounted failover are
release-gated in the lab. Do not claim production HA, broad distro
compatibility, performance, upgrade safety, or multi-node readiness until
separately tested.
## Product Phases
### Alpha Preview
- Status: current.
- Status: protocol-gated; moving toward beta hardening.
- Single-node k3s quick start works.
- Dynamic PVC create/delete works.
- App pod writes and reads through a PVC.
- Cleanup leaves no active iSCSI sessions and no visible Kubernetes residue.
- Default frontend: iSCSI.
- Optional frontend: NVMe-oF, behind explicit protocol selection and release
gates.
- Default backend: `walstore`.
### Alpha Stabilization
@@ -53,6 +56,18 @@ This is the short internal roadmap. Keep it current and readable.
- Reproducible release images.
- Documented operational limits.
### Iterative Release Rule
- Do not wait for the full enterprise block vision before publishing useful
slices.
- Every hardening phase should have a user-visible preview with clear
non-claims.
- TestOps evidence is release evidence, but user installs and issues are the
feedback loop.
- Keep the basic block product and basic runner open enough to build trust;
reserve advanced fleet automation, private scenario corpus, hosted
validation, and enterprise operations as possible enterprise layers.
## Priority Tracks
### Track A: Kubernetes Install And Cleanup
@@ -64,11 +79,11 @@ This is the short internal roadmap. Keep it current and readable.
### Track B: iSCSI Frontend Stability
- Current: OS initiator correctness, session stability, product-backed K8s
fio/attach-detach, CHAP, CSI node restart, ALUA/MPIO, and mounted failover
are implemented and evidenced in PR #42.
- Next: backend comparison and repeatability evidence for regular WAL versus
smartwal.
- Current: Linux/open-iscsi and Windows 11 built-in Initiator correctness are
validated for the current alpha claim. Evidence includes mkfs/NTFS format,
checksum write/read, cleanup, and Linux dmesg-delta checks.
- Next: move remaining iSCSI work to component-first session/backend pressure
tests instead of broad V2 porting.
- Later: larger compatibility coverage across host distros and initiator
versions.
@@ -76,21 +91,34 @@ This is the short internal roadmap. Keep it current and readable.
- Current: alpha generated workloads still use throwaway storage in several
paths.
- Next: define durable root layout for generated `blockvolume` workloads.
- Later: prove restart and reattach preserve data.
- Next: define durable root layout for generated `blockvolume` workloads and
prove restart/reattach preserves data.
- Later: integrate returned-replica rebuild and storage-engine compaction.
### Track D: Availability And Recovery
- Current: recovery/failover components are tested below the K8s surface.
- Next: multi-node attach and reconnect path.
- Later: failover while mounted, old-primary stale I/O fencing, returned
replica reintegration.
- Current: iSCSI and NVMe mounted failover are release-gated in single-node lab
scenarios.
- Next: returned-replica state machine, old-primary stale I/O fencing, and
multi-node attach/reconnect path.
- Later: rebuild/reintegration and longer soak under failure.
### Track E: Protocol / Backend Expansion
- Current: iSCSI + `walstore` only for alpha.
- Next: protocol-neutral CSI dispatch tests.
- Later: NVMe-oF, `smartwal`, and multipath after the default path is stable.
- Current: iSCSI and NVMe-oF are protocol-gated frontends. `walstore` remains
the MVP backend.
- Next: storage-engine boundary tests, backend pressure behavior, and
smartwal/delta experiments behind explicit gates.
- Later: RDMA/KV-backed data-plane experiments and semantic storage protocols
only after the block core is mature.
### Track F: Operations Layer
- Current: operations are split across scripts, TestOps, and product logs.
- Next: define install/upgrade/uninstall, generated workload ownership,
operator-visible status, diagnostics bundle, and conservative admin controls.
- Later: enterprise operations, hosted validation, fleet automation, and
cloud-scale test lifecycle.
## PR Cadence
@@ -103,8 +131,9 @@ This is the short internal roadmap. Keep it current and readable.
## Current Execution Pointer
- Active work should be tracked in `internal/docs/current-plan.md`.
- When the current plan closes, rename it to a finished plan such as
`internal/docs/iscsi-p2-plan-finished.md`.
- When the current plan closes, move it to `internal/docs/finished-plans/`
with a phase/topic filename such as
`phase1_finishedplan_frontend_protocol_readiness.md`.
- Keep deeper technical design in separate files only when it is needed for
review or future maintenance.
- Keep long audits and historical references under `internal/docs/ref/`.
@@ -0,0 +1,122 @@
# QA Assignment: CSI RF=1 Durable Blockvolume Restart Validation
Status: draft, waiting for first lab run.
Branch: `plan-roadmap-refresh`.
Scope: prove a single-replica dynamic PVC survives a generated `blockvolume`
pod restart when the launcher renders durable host state. This is the first
RF=1 reliable-restart gate for the beta-hardening plan.
## Preconditions
- Host: M02 k3s lab or equivalent single-node Kubernetes lab.
- Required host tools:
- `kubectl`,
- Docker image build/load path for `sw-block:local` and
`sw-block-csi:local`,
- iSCSI initiator tools for the default protocol path.
- Build and import fresh alpha images before running, preferably through the
existing pin-build/TestOps path.
- This gate must run with durable generated workload state:
```bash
export SW_BLOCK_LAUNCHER_STATE_HOSTPATH=/var/lib/sw-block/testops-${RUN_ID}
```
Do not mark the gate green if the generated `blockvolume` manifest still uses
`emptyDir` for the state volume. Use a run-scoped hostPath under
`/var/lib/sw-block/testops-*` so repeat runs do not reuse stale durable roots.
## Test 1: RF=1 Dynamic PVC Survives Blockvolume Restart
Script command:
```bash
RUN_ID="$(date -u +%Y%m%dT%H%M%SZ)-csi-rf1-blockvolume-restart"
SW_BLOCK_ALPHA_IMAGES_ENV="/path/to/pin-build/alpha-images.env" \
SW_BLOCK_ARTIFACT_DIR="/mnt/smb/work/share/g15d-k8s/${RUN_ID}" \
SW_BLOCK_LAUNCHER_STATE_HOSTPATH="/var/lib/sw-block/testops-${RUN_ID}" \
bash scripts/run-k8s-blockvolume-restart.sh "$PWD"
```
Expected:
- `run.log` contains:
- `launcher_state_hostpath=/var/lib/sw-block`,
- `restart_blockvolume_before_reader=1`,
- `demo-app-pvc-writer-hold-root.yaml`,
- `delete writer pod but keep PVC`,
- `restart generated blockvolume Deployment before replacing the app pod`,
- `start reader pod on the same PVC`,
- final line:
`[app-demo] PASS: app pod wrote data, replacement app pod read it back through the same PVC, cleanup complete`.
- `block-stack.rendered.yaml` contains:
- `--launcher-state-hostpath=/var/lib/sw-block/testops-${RUN_ID}`.
- `generated-blockvolume.yaml` contains:
- `hostPath:`,
- `path: /var/lib/sw-block/testops-${RUN_ID}`,
- `type: DirectoryOrCreate`,
- no `emptyDir:` under the generated `state` volume,
- `--durable-root=/var/lib/sw-block/<volume>/<replica>`.
- `writer.log` contains:
- `[app-writer] wrote and verified /data/demo.bin`.
- `iscsi-sessions.before-blockvolume-restart.txt` exists and contains no
`iqn.2026-05.io.seaweedfs` session. This proves the writer pod unmounted and
CSI logged out before the `blockvolume` process restart.
- `restart-blockvolume-status.log` shows the generated `blockvolume`
Deployment completed rollout after the writer checksum.
- `blockvolume-pod-ids.before-restart.tsv` and
`blockvolume-pod-ids.after-restart.tsv` are both non-empty and contain
different pod UIDs. This proves the serving `blockvolume` pod was replaced.
- `lifecycle-volumes.after-blockvolume-restart.json` exists and still contains
the PVC volume spec with `protocol: "iscsi"`.
- `reader.log` contains:
- `/data/demo.bin: OK`.
- `reader.describe.before-delete.txt` shows:
- `Status: Succeeded`,
- `SuccessfulAttachVolume`.
- `blockvolume-generated.after-restart.log` contains:
- `phase":"iscsi-listening"`,
- `durable primary lineage ensured`.
Together with the reader checksum, this proves the restarted target recovered
and the replacement reader pod reattached/read after restart. Do not require a
live iSCSI session after the one-shot reader exits; Kubernetes may unstage and
logout immediately after the pod reaches `Succeeded`.
- Cleanup:
- no generated `sw-blockvolume` Deployment remains,
- demo PVC is gone,
- no `iqn.2026-05.io.seaweedfs` iSCSI session remains.
- the run-scoped hostPath `/var/lib/sw-block/testops-${RUN_ID}` is gone.
## What This Proves
- The launcher can render durable generated workload state for a dynamic PVC.
- A generated `blockvolume` pod can restart and recover the same durable root.
- `blockmaster` remains in the loop: the restarted workload must re-observe and
keep enough lifecycle/frontend state for CSI to rediscover and reattach.
- A replacement app pod can read data written before the restart.
## What This Does Not Prove
- No RF=2/RF=3 promotion or returned-replica catch-up claim.
- No node reboot claim.
- No multi-node scheduling claim.
- No production storage claim for `hostPath`.
- No NVMe multipath claim.
## Report Format
QA should report:
- branch and commit SHA,
- host and kernel,
- exact command,
- result,
- artifact path,
- final PASS line,
- generated manifest state-volume evidence,
- writer and reader checksum lines,
- blockvolume rollout evidence,
- master/lifecycle evidence after restart,
- cleanup state,
- any CSI, kubelet, iSCSI, or blockvolume errors.
@@ -0,0 +1,155 @@
# QA Assignment: iSCSI OS Windows Initiator Validation
Status: pending.
Scope: validate the same V3 iSCSI target with the Windows built-in iSCSI
Initiator and filesystem stack.
This is the second-bar check for the current
`iSCSI OS-Initiator Compatibility Closure` plan. Linux/open-iscsi is already
green at `8e220e5`; this assignment decides whether Windows support can be
claimed now or must stay an explicit non-claim.
## Preconditions
- Windows host with administrator PowerShell.
- Windows iSCSI Initiator service available.
- m02 reachable from the Windows host.
- m02 checkout on the branch under test.
- No active sw-block iSCSI sessions before the run.
- Use a non-production test target. The validation formats a disk.
## Start V3 Target On m02
Run on m02 from the product checkout:
```bash
RUN_ID="$(date -u +%Y%m%dT%H%M%SZ)-iscsi-windows-target"
PORT=36260
ART="/mnt/smb/work/share/g15d-k8s/${RUN_ID}"
WORK="/tmp/sw-block-iscsi-windows-target-${RUN_ID}"
SW_BLOCK_ARTIFACT_DIR="$ART" \
SW_BLOCK_ISCSI_WORK_DIR="$WORK" \
SW_BLOCK_ISCSI_PORT="${PORT}" \
SW_BLOCK_ISCSI_TARGET_ONLY=1 \
SW_BLOCK_ISCSI_TARGET_HOLD_SECONDS=900 \
SW_BLOCK_DURABLE_BLOCKS=65536 \
SW_BLOCK_ISCSI_STRESS=none \
bash scripts/run-iscsi-os-smoke.sh "$PWD"
```
Expected target-side setup:
- `run.log` prints `target-only mode`.
- `run.log` prints portal `127.0.0.1:<PORT>`.
- `target-ready.env` exists and contains:
- `SW_BLOCK_ISCSI_TARGET_READY=1`,
- `SW_BLOCK_ISCSI_IQN=...`,
- `SW_BLOCK_ISCSI_PORTAL=...`.
- `blockvolume.log` has the iSCSI listener and no startup error.
- Target holds for the configured time, then cleans itself up.
Keep the target loopback-only. The product intentionally refuses
unauthenticated external binds. For Windows validation, use an SSH local
forward from the Windows controller:
```powershell
ssh -i C:/work/dev_server/testdev_key `
-N -L 36260:127.0.0.1:36260 `
testdev@192.168.1.184
```
Leave that SSH process running while executing the Windows initiator steps.
## Windows Initiator Steps
Run from administrator PowerShell. Adjust `$Portal` and `$Port` if the target
command used different values.
```powershell
$Portal = "127.0.0.1"
$Port = 36260
$IQN = "iqn.2026-05.io.seaweedfs:os-smoke-v1"
$Mount = "S"
Start-Service MSiSCSI
New-IscsiTargetPortal -TargetPortalAddress $Portal -TargetPortalPortNumber $Port
$target = Get-IscsiTarget | Where-Object { $_.NodeAddress -eq $IQN }
if (-not $target) { throw "target not discovered: $IQN" }
Connect-IscsiTarget -NodeAddress $IQN -IsPersistent $false
$disk = Get-Disk | Where-Object { $_.BusType -eq "iSCSI" -and $_.OperationalStatus -eq "Online" } |
Sort-Object Number -Descending |
Select-Object -First 1
if (-not $disk) { throw "no online iSCSI disk found" }
if ($disk.PartitionStyle -eq "RAW") {
Initialize-Disk -Number $disk.Number -PartitionStyle GPT
}
$partition = New-Partition -DiskNumber $disk.Number -UseMaximumSize -DriveLetter $Mount
Format-Volume -DriveLetter $Mount -FileSystem NTFS -Confirm:$false
$path = "${Mount}:\payload.bin"
$copy = "${Mount}:\payload.copy.bin"
$bytes = New-Object byte[] (4MB)
$rng = [System.Security.Cryptography.RNGCryptoServiceProvider]::Create()
$rng.GetBytes($bytes)
$rng.Dispose()
[IO.File]::WriteAllBytes($path, $bytes)
Copy-Item $path $copy
$h1 = (Get-FileHash $path -Algorithm SHA256).Hash
$h2 = (Get-FileHash $copy -Algorithm SHA256).Hash
if ($h1 -ne $h2) { throw "checksum mismatch" }
Remove-Item $path, $copy -Force
Remove-Partition -DriveLetter $Mount -Confirm:$false
Disconnect-IscsiTarget -NodeAddress $IQN -Confirm:$false
Remove-IscsiTargetPortal -TargetPortalAddress $Portal -TargetPortalPortNumber ([UInt16]$Port) -Confirm:$false
```
## Expected Result
- Windows discovers the target IQN.
- Connect succeeds.
- Windows sees exactly one new iSCSI disk for the test target.
- NTFS format succeeds.
- 4 MiB write/copy/read checksum succeeds.
- Disconnect succeeds.
- m02 target exits cleanly after the hold window or after manual stop.
- No lingering Windows iSCSI session for the test IQN.
- No lingering m02 `blockmaster` or `blockvolume` process after target cleanup.
## Evidence To Report
- Product branch and commit.
- Runner/script commit if TestOps is involved.
- Windows version.
- m02 kernel.
- Target artifact path.
- `run.log`.
- `blockvolume.log`.
- Windows PowerShell transcript or copied command output.
- `Get-IscsiSession` output after cleanup.
- m02 process cleanup output.
## Failure Classification
If the run fails, classify the first failure point:
- discovery failure,
- login/connect failure,
- disk materialization failure,
- initialize/partition/format failure,
- write/read/checksum failure,
- disconnect/cleanup failure.
Attach Windows event log snippets only if they add a concrete error code.
## Non-Claims
- This is not a performance benchmark.
- This is not MPIO.
- This is not CHAP.
- This is not failover.
- This is not a broad Windows Server matrix.
- This validates one Windows host against one V3 target profile.
@@ -0,0 +1,119 @@
# Beta Hardening Suite Cost Map
Evidence source: first full green `beta-hardening-gate` run.
- Run id: `20260511-031605-8258`
- Product commit: `8822f20e91c2b88727ead9e49f9bf75eec28c791`
- Runner commit: `cf65daaf2ce5cf500e1efa48b411f7cb66dbac0b`
- Suite wall clock: `1305.86s` (`21m46s`)
- Validator: `swblock validate-bundle --profile beta-hardening --expect-commit 8822f20`
returned `VALID`
## Per-Child Cost
| Child | Wall Clock | Share | Class | Recommendation |
| --- | ---: | ---: | --- | --- |
| `iscsi-p8-compat-soak` | `659s` (`10m59s`) | `50.5%` | release/periodic integration | Keep as a release and periodic soak gate. Do not make it the normal developer loop. Add smaller component contracts only for concrete failures it discovers. |
| `nvme-p5-csi-protocol` | `273s` (`4m33s`) | `20.9%` | K8s integration plus componentizable protocol-shape checks | Keep one K8s end-to-end smoke. Move StorageClass protocol extraction, lifecycle protocol persistence, and launcher manifest argument rendering into component tests. |
| `csi-rf1-durable-restart` | `165s` (`2m45s`) | `12.6%` | restart integration plus componentizable state contracts | Keep one restart integration. Move durable-root selection, status/projection refresh, and reattach expectations into component contracts. |
| `nvme-p4-multipath-failover` | `138s` (`2m18s`) | `10.6%` | kernel integration | Keep. Linux NVMe multipath, ANA, namespace grouping, and mounted failover need the real kernel path. Keep field-level assertions to make failures local. |
| `iscsi-p6-alua-failover` | `36s` | `2.8%` | integration | Keep. It is cheap and covers real initiator ALUA behavior. |
| `iscsi-returned-replica` | `27s` | `2.1%` | integration | Keep. It is cheap and covers the authority/returned-replica behavior against a live target. |
| `cleanup-residue` | `3s` | `0.2%` | hygiene gate | Keep as a final suite child. It is cheap and prevents false confidence after PASS. |
| `csi-lifecycle-component` | `2s` | `0.2%` | component | Keep in the default loop. |
| `operations-status-diagnostics` | `2s` | `0.2%` | component | Keep in the default loop. Expand when operations contracts are added. |
| `returned-replica-component` | `1s` | `0.1%` | component | Keep in the default loop. |
## What This Means
The suite cost is dominated by three children:
1. `iscsi-p8-compat-soak` is about half the suite.
2. `nvme-p5-csi-protocol` is about one fifth.
3. `csi-rf1-durable-restart` is about one eighth.
The correct response is not to remove integration coverage. The release gate
exists because Linux initiators, K8s lifecycle, and real process restarts have
already exposed bugs that were not caught by the existing lower-level coverage.
The correct response is to stop using the full suite as the first debugging
tool. Fast component and contract tests should catch protocol-shape bugs before
the 20-minute suite is needed.
## First Componentization Target
Target: `nvme-p5-csi-protocol`.
Reason:
- It costs `273s`, roughly `21%` of the suite.
- Its past failures were mostly shape/provenance issues:
- protocol parameter lost or stale in the StorageClass to CSI path,
- lifecycle spec missing or not persisting `protocol`,
- launcher rendering iSCSI args for an NVMe volume,
- stale image/version evidence.
- These are deterministic contracts and do not require a full K8s data-path
run to validate at development time.
Recommended lower-level contracts:
- CSI CreateVolume parameter extraction maps supported aliases to the same
internal frontend protocol:
- `protocol`,
- `sw-block.seaweedfs.com/protocol`,
- `frontendProtocol`.
- CSI CreateVolume rejects conflicting or invalid protocol parameters with a
deterministic error before lifecycle state is written.
- Lifecycle volume spec persists explicit `protocol` for both `nvme` and
default `iscsi`.
- Launcher manifest rendering emits:
- NVMe: `--nvme-listen=`, `--nvme-subsysnqn=`, `--nvme-ns=1`, and no iSCSI
args.
- iSCSI: `--iscsi-listen=`, `--iscsi-iqn=`, and no NVMe args.
- Version/provenance checks reject stale images before a workload starts.
Keep the runner-native `nvme-p5-csi-protocol` child as the end-to-end proof
that the component contracts still compose inside k3s.
## Second Componentization Target
Target: `csi-rf1-durable-restart`.
Reason:
- It costs `165s`, roughly `13%` of the suite.
- It covers real restart semantics that must remain integrated, but several
invariants can be made cheap:
- durable root path and block file identity are preserved across restart,
- blockvolume re-registers with the expected volume/replica identity,
- master observes the restarted frontend status,
- CSI can reattach only after status/projection is valid.
Keep one live restart scenario because process death, master observation, and
K8s attachment timing are integration concerns.
Initial runner-native fast gate:
`testops/scenarios/csi-rf1-durable-restart-component-gate.yaml`.
## Do Not Componentize These Away
- `nvme-p4-multipath-failover`: requires Linux NVMe/TCP multipath and ANA
behavior. Component tests can cover Identify/ANA bytes, but the gate needs the
kernel.
- `iscsi-p6-alua-failover`: requires initiator multipath behavior. It is also
cheap enough to keep.
- `iscsi-p8-compat-soak`: should remain a release/periodic soak. Split only if
a stable fast smoke can preserve the release signal and the long soak remains
scheduled somewhere else.
## Next Plan Input
After beta repeatability is stamped, start with the `nvme-p5-csi-protocol`
component contract slice. The delivery should be:
- fast component tests for protocol extraction, persistence, and render shape,
- runner-native fast gate:
`testops/scenarios/nvme-p5-protocol-component-gate.yaml`,
- the existing runner-native P5 child still passing,
- a short doc note explaining which failures now fail in seconds and which still
intentionally require K8s.
@@ -0,0 +1,179 @@
# Durable Root Layout Contract
Status: active reference for the beta-hardening plan.
Purpose: define how generated `blockvolume` workloads should map durable state
onto Kubernetes storage. This closes the gap where the workload had a
`--durable-root` argument but the pod state volume was still `emptyDir`.
## Product Rule
`emptyDir` is allowed only for explicit throwaway smoke tests.
Any scenario that claims data survives `blockvolume` restart must use a durable
state volume and must capture the rendered manifest proving it.
Durable restart is not only a local storage check. For Kubernetes product
behavior, the gate must include:
```text
blockvolume restart
-> local durable recovery
-> blockmaster re-observation
-> refreshed frontend target facts
-> CSI rediscovery / reattach
-> checksum verification
```
## Container Layout
Inside the `blockvolume` container:
```text
/var/lib/sw-block/
<volume-id>/
<replica-id>/
durable backend files
```
The launcher passes:
```text
--durable-root=/var/lib/sw-block/<volume-id>/<replica-id>
```
The container mount point remains:
```text
/var/lib/sw-block
```
## Kubernetes State Volume Modes
### Throwaway Smoke Mode
Default rendering uses:
```yaml
volumes:
- name: state
emptyDir: {}
```
Claims allowed:
- protocol smoke,
- manifest rendering,
- checksum write/read during one pod lifetime.
Claims not allowed:
- blockvolume pod restart durability,
- node reboot durability,
- returned-replica durability,
- beta data-retention behavior.
### Durable Lab Mode
When `K8sRenderConfig.StateHostPathBase` is set, rendering uses:
```yaml
volumes:
- name: state
hostPath:
path: <StateHostPathBase>
type: DirectoryOrCreate
```
The container still receives:
```text
--durable-root=/var/lib/sw-block/<volume-id>/<replica-id>
```
Example mapping:
```text
host: /var/lib/sw-block/pvc-a/r1
container: /var/lib/sw-block/pvc-a/r1
```
`blockmaster` exposes this through:
```text
--launcher-state-hostpath=/var/lib/sw-block
```
The alpha install/dynamic scripts expose the same choice through:
```text
SW_BLOCK_LAUNCHER_STATE_HOSTPATH=/var/lib/sw-block
```
Leaving the flag empty keeps the throwaway `emptyDir` rendering. Durable
restart gates must set the flag explicitly and capture the generated manifest.
This is acceptable for single-node and node-local lab evidence. Multi-node
behavior must ensure the same replica is scheduled back onto the node that owns
its hostPath state, or use a real persistent volume per replica.
## Required Evidence
A durable restart/reattach QA bundle must include:
- generated `blockvolume` manifest,
- proof the state volume is not `emptyDir`,
- `--durable-root` argument,
- blockmaster status before and after restart,
- proof the restarted replica re-registered frontend target facts,
- CSI ControllerPublish / NodeStage evidence after restart or reattach,
- pre-restart checksum,
- post-restart checksum,
- blockvolume version,
- cleanup state.
## Replica-Factor Scope
### RF=1 Reliable Restart
RF=1 proves:
```text
same replica + same node + same durable root + master re-observation
=> CSI can reattach and bytes survive
```
Master behavior:
- observe heartbeat loss,
- mark frontend unavailable,
- keep volume intent,
- observe the same replica after restart,
- record fresh status / endpoint version / frontend facts,
- allow CSI to rediscover the target.
Master does not promote another replica because none exists.
### RF=2 / RF=3 Restart And Reintegration
RF=2/3 is a different gate. It must prove:
```text
primary loss
-> master promotion
-> old primary fenced on return
-> returned replica reports recovered frontier
-> catch-up completes
-> ready / ACK / promotion eligibility restored
```
The old primary must not serve writes just because its local durable root
recovered. It must first be classified and caught up.
## Non-Claims
- hostPath durable lab mode is not a production storage recommendation.
- This contract does not define backup, snapshots, migration, or encryption.
- This contract does not solve returned-replica rebuild semantics.
- This contract does not replace the future operator/controller ownership
model.
@@ -68,7 +68,26 @@ Representative V3 tests:
- `core/frontend/iscsi/p1_large_read_test.go`
- `core/frontend/iscsi/datain_test.go`
## High-Value Gaps From V2
## 2026-05-09 Refresh: Current Classification
The protocol-readiness phase closed several gaps that were open when this audit
was written:
| Gap | Current classification | Evidence / next action |
|---|---|---|
| RX/TX session stress | Mostly covered by component tests and P8 soak. | Keep adding focused component tests for specific regressions. |
| Large-write memory / slow backend | Partially covered at protocol level; backend pressure remains active. | Move next work to storage-engine pressure contracts. |
| Product-backed iSCSI stability | Release-gated. | `iscsi-p8-compat-soak-chain` is the runner gate. |
| CHAP | Closed. | Target-side CHAP and CSI node CHAP are implemented and lab-validated. |
| ALUA / MPIO foundation | Release-gated. | `iscsi-p6-alua-failover-chain` covers ALUA + mounted failover. |
| CSI node lifecycle hardening | Still active. | Component-first beta hardening work. |
| NVMe QA breadth | Release-gated for ANA/multipath/CSI path; perf breadth remains active. | Keep P4/P5 gates; defer perf matrix. |
The next iSCSI/V2-parity work should not re-open protocol bring-up. It should
focus on CSI lifecycle, backend pressure, returned-replica behavior, and host
compatibility breadth.
## Historical High-Value Gaps From V2
### Gap 1: iSCSI RX/TX session stress
@@ -8,7 +8,38 @@ implementation. This is a product-facing coverage audit, not a port request.
Rule: copy expectations first, not code. If V3 rejects a V2 behavior, the audit
must say why.
## Summary
## 2026-05-09 Refresh: Current Classification
The audit below was written before the NVMe protocol-readiness phase completed.
Current state:
- NVMe OS smoke, inline/R2T classification, ANA Identify/Get Log Page, native
multipath discovery, mounted failover, and CSI dynamic PVC protocol selection
are release-gated.
- The Linux kernel accepted the ANA-aware, multi-controller, shared-namespace
shape after the controller ID, CMIC, NMIC, standby metadata, and script parser
fixes.
- The remaining NVMe work is not basic protocol enablement. It is beta
hardening:
- broader kernel/distro compatibility,
- labelled performance/queue profiles,
- backend pressure behavior,
- advanced optional commands such as DSM/Write Zeroes,
- keeping CSI lifecycle component tests protocol-neutral.
Updated classifications:
| Area | Current classification | Next action |
|---|---|---|
| IC / Fabric Connect / queue separation | Present and host-gated. | Keep component coverage. |
| ANA Identify + ANA log | Release-gated. | Keep field-level P3/P4 assertions. |
| Multipath mounted failover | Release-gated. | Keep P4 chain periodic. |
| CSI NVMe path | Release-gated. | Keep P5 chain and component propagation tests. |
| In-capsule / R2T | Inline path host-gated; R2T not triggered by current Linux profile. | Keep explicit "not triggered" classification; use alternate initiator or target mode before claiming R2T evidence. |
| WAL pressure / write retry | Active backend concern; target-side retry intentionally rejected. | Define storage-engine pressure contract. |
| Performance sweeps | Not beta-complete. | Add later after correctness and lifecycle hardening. |
## Historical Summary
- V3 already has a substantial NVMe/TCP protocol core:
- IC handshake,
@@ -0,0 +1,212 @@
# Operations Contract: Volume Status Report
Status: selected first operations-layer contract. This is a contract target for
the active plan, not an operator implementation.
This is an observability/status report. It is not a V2-style block/data
snapshot, clone, backup, rollback point, or data-preservation feature.
## Purpose
Operators need one stable read-only view that answers:
```text
What volume is this host serving, what role does it believe it has, what
frontend facts are exposed, what durable lineage is latched, and what residue
or peer condition should block unsafe action?
```
Today these facts exist across status endpoints, lifecycle records, runner
artifacts, and host initiator state. The first operations-layer step is to make
that shape explicit before building admin actions around it.
## Existing Inputs
Current product surfaces:
- master `QueryVolumeStatus` / `StatusResponse`
- assigned volume/replica facts,
- protocol frontend targets:
- protocol,
- address,
- iSCSI IQN/LUN,
- NVMe NQN/NSID.
- `GET /status?volume=<id>`
- `VolumeID`
- `ReplicaID`
- `Epoch`
- `EndpointVersion`
- `Healthy`
- `FrontendPrimaryReady`
- `AuthorityRole`
- `ReplicationRole`
- `GET /status/durable?volume=<id>`
- `VolumeID`
- `ReplicaID`
- `VolumeCount`
- per-volume durable status:
- `VolumeID`
- `Path`
- `Impl`
- `ReplicaID`
- `Epoch`
- `EndpointVersion`
- `Latched`
- `Operational`
- `Evidence`
- `Closed`
- `GET /status/peers?volume=<id>`
- primary-side peer readiness when a peer source is installed.
- current raw peer fields:
- `ReplicaID`
- `State`
- `Epoch`
- `EndpointVersion`
- `DataAddr`
- `CtrlAddr`
- `SessionID`
- `ProbeInFlight`
- `Closed`
- TestOps artifacts:
- product git revision,
- runner git revision,
- scenario provenance,
- iSCSI session state,
- NVMe subsystem state,
- K8s resource state,
- cleanup actions.
## Report Shape
The contract should produce an append-only JSON object with these sections.
### Header
- `schema_version`
- `captured_at`
- `source`
- `component`
- `host`
- `scenario`
- `product_revision`
- required when captured from TestOps,
- otherwise explicit `unavailable`.
- `runner_revision`, when captured by TestOps
### Volume
- `volume_id`
- `replica_id`
- `protocols`
- `iscsi`
- `nvme`
- `frontends`
- `protocol`
- `addr`
- `iqn`, for iSCSI
- `nqn`, for NVMe
- `lun` / `nsid`
### Authority
- `epoch`
- `endpoint_version`
- `authority_role`
- `primary`
- `superseded`
- `unknown`
- `frontend_primary_ready`
- `healthy`
### Replication
- `replication_role`
- `none`
- `recovering`
- `not_ready`
- `replica_ready`
- `unknown`
- `peers`
- `replica_id`
- `state`
- `data_addr`
- `ctrl_addr`
- `healthy`, derived as `state == "healthy"` until the product exposes an
explicit boolean
- `epoch`
- `endpoint_version`
- `session_id`
- `probe_in_flight`
- `closed`
- `last_error`, explicit `unavailable` until the product exposes one
### Durable
- `durable`
- `impl`
- `path`
- `replica_id`
- `epoch`
- `endpoint_version`
- `latched`
- `operational`
- `closed`
- `evidence`
### Residue
Residue is diagnostic and should not trigger destructive action by itself.
- `host_initiator`
- `iscsi_sessions`
- `nvme_subsystems`
- `processes`
- V3 process matches
- `kubernetes`
- blockmaster resources
- blockvolume resources
- CSI resources
- PVC/PV residue
- `storage_paths`
- durable roots observed
- unmanaged paths, if any
## Safety Rules
- Report generation is read-only.
- Report generation must not mutate authority, lifecycle, storage, sessions, or
K8s.
- Report schema must be append-only; new fields are allowed, existing field
meaning is not.
- Missing optional inputs must be represented explicitly as unavailable, not
silently omitted.
- A future `force_detach` or cleanup command must not be built only on this
report. It needs fencing semantics and a separate admin protocol.
## Non-Claims
- This is not a block/data snapshot.
- This is not a clone, backup, rollback, or restore feature.
- This is not an operator.
- This is not a production API.
- This does not authorize force detach.
- This does not prove HA.
- This does not replace TestOps run bundles.
- This does not expose a public unauthenticated endpoint.
## First Implementation Target
Start with a component-level collector that can assemble the report from
existing in-process/status-test data:
- status projection,
- durable status,
- peer status,
- synthetic residue inputs.
Then add a runner-native component gate that asserts:
- primary projection includes frontend-ready authority facts,
- returned replica can be durable-ready but frontend-fenced,
- durable lineage is visible without log scraping,
- missing peer/durable inputs are represented explicitly.
@@ -0,0 +1,150 @@
# Operations Guide: Reading `VolumeStatusReport`
Status: first operator-facing reading guide for the read-only operations status
report. This guide explains what the report can support today and what it must
not be used to decide.
This guide is intentionally conservative. A `VolumeStatusReport` is evidence,
not authority.
## What The Report Is
`VolumeStatusReport` is a schema-controlled JSON object assembled from existing
status facts:
- master volume assignment/status,
- local blockvolume status projection,
- replication peer status,
- durable lineage status,
- host/Kubernetes residue facts,
- product and runner provenance.
The report is read-only. Collection must not promote, demote, detach, clean,
restart, create sessions, remove sessions, create Kubernetes resources, or
delete Kubernetes resources.
## Safe Operator Questions
The report may be used to answer these questions:
- Which `volume_id` and `replica_id` did this host report?
- Which frontend protocols and identities were advertised?
- Did the local replica report `authority_role=primary`, `superseded`, or
`unknown`?
- What `epoch` and `endpoint_version` did the local replica report?
- Did the frontend report `frontend_primary_ready=true`?
- Which replication peers were known, and what state did each peer report?
- Which durable lineage was latched: `replica_id`, `epoch`,
`endpoint_version`, `latched`, `operational`, and `closed`?
- Was host or Kubernetes residue observed at collection time?
- Which product and runner revisions produced the evidence?
## Unsafe Conclusions
The report must not be used alone to conclude:
- It is safe to force detach a volume.
- It is safe to delete a durable path.
- It is safe to promote or demote a replica.
- A stale primary is fully fenced.
- A host is permanently dead.
- A volume is highly available.
- A filesystem or application workload is durable.
- A cleanup action is authorized.
- A rollback, clone, backup, or restore point exists.
Those decisions need a separate admin protocol with fencing, quorum/authority
semantics, and action-specific preconditions.
## Field Reading Rules
### `captured_at`
Use as the evidence timestamp. Do not treat old reports as current truth.
If a report is older than the operational question being asked, recollect.
### `product_revision` and `runner_revision`
Use to verify provenance. A report without matching expected revisions is still
evidence, but not release-gate evidence.
If `product_revision=unavailable`, do not use the report to prove a specific
commit passed.
### `volume`
Use `volume.volume_id`, `volume.replica_id`, `protocols`, and `frontends` to
confirm the target shape the product exposed.
Do not infer that a host initiator is connected only because a frontend is
listed. Frontends describe product exposure, not client-side attachment.
### `authority`
Use `authority_role`, `epoch`, `endpoint_version`, `assigned`,
`frontend_primary_ready`, and `healthy` to understand the local replica's
reported role.
Do not use `authority_role=primary` alone as permission to serve writes in an
external workflow. Serving writes is a product data-path behavior, not an
operator action.
Do not use `authority_role=superseded` alone as proof that all remote clients
have drained.
### `replication`
Use peer entries to understand the local replica's view of peer health and
lineage. A missing peer list is evidence that the peer source was unavailable
or empty, not proof that no peer exists.
`last_error=unavailable` means the current product source did not provide a
structured peer error. It does not mean "no error."
### `durable`
Use durable entries to inspect latched replica identity and epoch lineage.
`latched=true` and `operational=true` are useful evidence that the durable
backend recognized its identity. They are not enough to authorize deletion,
rollback, or force rejoin.
### `residue`
Use residue arrays to block unsafe manual action and to guide cleanup
investigation.
Empty residue arrays mean "nothing was observed by this collector at this
time." They do not prove the environment is globally clean.
## Escalation Paths
If the report shows conflicting or unsafe evidence:
- `authority_role=primary` on more than one replica:
stop and inspect authority/fencing logs; do not issue cleanup.
- durable lineage differs from authority lineage:
stop and inspect durable backend identity; do not promote or delete.
- frontend is ready while durable is not operational:
treat as a product bug or incomplete status; collect product logs.
- residue remains after a supposedly clean run:
block release-gate pass and collect host/Kubernetes state.
- product revision is missing or mismatched:
rerun with pinned build/provenance before using as milestone evidence.
## Minimal Release-Gate Use
A release gate may use the report as supporting evidence when all of these are
true:
- expected `product_revision` is present,
- expected `runner_revision` or runner provenance is present when applicable,
- schema version is supported,
- key arrays are present as arrays, not `null`,
- report artifact is collected into the run bundle,
- scenario-specific assertions validate the fields required by that scenario.
The report remains supporting evidence. The release gate still needs workload
or component assertions appropriate to the scenario.
@@ -0,0 +1,169 @@
# TestOps Runner Binary Contract
Status: active reference for beta-hardening work.
Purpose: keep the product repo, runner repo, developer workstation, and QA lab
aligned on what binary executes runner-native scenarios.
## Binary Identity
`swblock` is the standalone `sw-test-runner` binary for Seaweed Block / V3.
- Runner repo: `pingqiu/sw-test-runner`
- Main package: `cmd/swblock/main.go`
- Build command:
```bash
go build -o swblock ./cmd/swblock
```
`swblock` links the shared runner engine plus the V3 product action set:
- core actions,
- iSCSI actions,
- NVMe actions,
- Kubernetes actions,
- V3-specific product pack actions.
Sibling binaries use the same engine with different linked action sets:
- `weedblock`: V2 product pack.
- `cmd/sw-test-runner`: broad development / kitchen-sink binary.
## Path Convention
QA currently keeps a Windows build at:
```text
C:\work\swblock.exe
```
Developer machines should either put the binary on `PATH` as `swblock` or call
it by full path. Linux controllers should do the same with a Linux build of the
binary.
The product repo should not vendor the runner binary. The product repo owns
scenario content; the runner repo owns execution.
## Product-Side Build Helper
This product repo includes a helper for developer/QA convenience. It does not
vendor the binary; it builds from a local `sw-test-runner` checkout or clones
the runner repo when allowed.
Windows:
```powershell
.\internal\tools\build-swblock.ps1
```
Linux / Git Bash:
```bash
bash internal/tools/build-swblock.sh
```
Useful options:
```powershell
.\internal\tools\build-swblock.ps1 -RunnerRoot C:\work\sw-test-runner
.\internal\tools\build-swblock.ps1 -NoClone
```
```bash
bash internal/tools/build-swblock.sh --runner-root /path/to/sw-test-runner
bash internal/tools/build-swblock.sh --no-clone
```
Default output:
```text
<product-root>/.tools/swblock.exe # Windows
<product-root>/.tools/swblock # Linux
<product-root>/.tools/swblock.path # file containing the built binary path
```
## Expected Commands
Validate a product-owned scenario:
```bash
swblock validate testops/scenarios/csi-rf1-durable-restart-chain.yaml
```
Run a product-owned scenario against m02:
```bash
swblock run testops/scenarios/csi-rf1-durable-restart-chain.yaml \
--env product_root=/tmp/seaweed_block \
--env ssh_key=C:/work/dev_server/testdev_key
```
Run the full protocol release gate:
```bash
swblock suite \
--results-dir V:/share/g15d-k8s/testops-runs/protocol-release-gate-native \
--env product_root=/tmp/seaweed-block-nvme-p4l \
--env ssh_key=C:/work/dev_server/testdev_key \
C:/work/seaweed_block/testops/suites/protocol-release-gate.yaml
```
Validate a finished protocol release gate bundle:
```bash
swblock validate-bundle --profile protocol-release-gate \
V:/share/g15d-k8s/testops-runs/protocol-release-gate-native/<run-id>
```
## Responsibility Boundary
Product repo:
- scenario YAML,
- product smoke scripts,
- field-level assertions,
- QA assignment docs,
- expected evidence and non-claims.
Runner repo:
- action registry,
- SSH/control execution,
- run-control status schema,
- result bundle layout,
- artifact collection,
- bundle validation.
QA:
- builds or receives the correct runner binary,
- runs product-owned scenarios/suites,
- reports result bundle path and validation output.
Developer:
- writes product-owned scenario content,
- keeps gates narrow and evidence-based,
- uses `swblock validate`/`run` locally when the binary is available.
## QA Assignment Policy
Use developer self-run for short feedback loops:
- `swblock validate` on a new or edited scenario,
- one child scenario run when the target lab is reachable,
- a focused re-run after a small scenario/product fix.
Assign QA when independence or lab discipline matters:
- milestone validation,
- release-gate validation,
- long soak / repeatability runs,
- runner feature validation such as status, cancellation, collection, or bundle
validation,
- complex scenario design where the product behavior and lab evidence still
need shaping.
This keeps TestOps productive: developers use the runner for immediate feedback,
while QA owns authoritative evidence and complex validation.
@@ -16,7 +16,31 @@ Kubernetes / CSI
The purpose is to identify protocol-executor behavior that was already learned
in V2 and must not be accidentally lost in V3.
## Current Finding
## 2026-05-09 Refresh: Post Protocol Release Gate
The original finding below is historical. The P0/P1 iSCSI and NVMe frontend
bring-up gaps were closed by the runner-native protocol release gate:
- iSCSI large write, Data-Out collection, pending queue, timeout, and large
Data-In splitting are implemented and covered.
- CHAP is implemented for target-side iSCSI and CSI node staging.
- iSCSI ALUA / mounted failover is release-gated by
`iscsi-p6-alua-failover-chain`.
- NVMe ANA, multipath discovery, mounted failover, and CSI protocol selection
are release-gated by `nvme-p4-multipath-failover-chain` and
`nvme-p5-csi-protocol-chain`.
- `iscsi-p8-compat-soak-chain` provides the current compatibility soak gate.
Remaining V2-parity work is no longer "make the frontend boot." It is beta
hardening:
- CSI node lifecycle adversarial coverage,
- backend pressure and WAL/durable-store behavior,
- returned-replica rebuild/reintegration,
- broader host/kernel compatibility matrix,
- longer soak and labelled performance evidence.
## Historical Finding
V3 can pass small K8s alpha writes, but a real OS initiator can still expose
protocol gaps.
@@ -41,6 +65,20 @@ initiator state machine, especially command pipelining during Data-Out/R2T.
## iSCSI Gap Table
Post-refresh classification:
| Area | Current classification | Next action |
|---|---|---|
| Data-Out collection / R2T / pending queue / timeout | Closed for current release gate. | Keep component tests; use runner only for OS evidence. |
| Multi Data-In reads | Closed for current release gate. | Keep large-read component coverage. |
| CHAP | Closed for target + CSI node staging. | Keep secret propagation and fail-closed tests. |
| ALUA / mounted failover | Release-gated. | Keep P6 chain; add component tests for any new state-machine change. |
| CmdSN / TX ownership / RXTX stress | Partially covered. | Add focused component stress only where missing; avoid new lab gates first. |
| Product-backed durable pressure | Still active. | Move to storage-engine/backend pressure tests. |
| CSI lifecycle hardening | Still active. | Component-first PRs for adversarial node lifecycle. |
Historical table:
| Area | V2 Shape | V3 Shape | Product Risk | Priority |
|---|---|---|---|---|
| Data-Out collection | `DataOutCollector` in `iscsi/dataio.go`, reusable and tested. | Inlined inside `Session.collectWriteData`. | Harder to reason about R2T/F-bit/DataSN edge cases. | P0 |
@@ -56,6 +94,20 @@ initiator state machine, especially command pipelining during Data-Out/R2T.
## NVMe Gap Table
Post-refresh classification:
| Area | Current classification | Next action |
|---|---|---|
| ANA Identify + Get Log Page | Release-gated. | Keep P3/P4 field-level asserts. |
| Multipath mounted failover | Release-gated. | Keep P4 chain periodic, not default developer loop. |
| CSI dynamic PVC protocol path | Release-gated. | Keep P5 chain and protocol propagation component tests. |
| Target-side write retry | Intentionally rejected for V3. | Surface backend errors; test storage pressure explicitly. |
| WAL pressure throttle | Active backend concern. | Define storage-engine pressure contract. |
| IO queue / performance matrix | Not beta-complete. | Add labelled perf/soak only after correctness. |
| DSM / Write Zeroes / advanced commands | Deferred. | Separate storage feature, not current beta blocker. |
Historical table:
| Area | V2 Shape | V3 Shape | Product Risk | Priority |
|---|---|---|---|---|
| ANA | V2 has ANA provider, ANA log page, ANA state QA. | V3 intentionally zeros ANA identify fields in current tests. | NVMe multipath/failover cannot be claimed yet. | P1/P2 |
@@ -0,0 +1,53 @@
package testops
import (
"os"
"path/filepath"
"strings"
"testing"
)
func TestCSIRF1DurableRestartScripts_PinBlockvolumeRestartContract(t *testing.T) {
body := readRepoFile(t, "scripts", "run-alpha-app-demo.sh")
for _, want := range []string{
"SW_BLOCK_RESTART_BLOCKVOLUME_BEFORE_READER",
"SW_BLOCK_LAUNCHER_STATE_HOSTPATH",
"blockvolume restart mode requires SW_BLOCK_LAUNCHER_STATE_HOSTPATH",
"restart_blockvolume_deployment()",
"wait_no_swblock_iscsi_sessions",
"blockvolume-pod-ids.before-restart.tsv",
"blockvolume-pod-ids.after-restart.tsv",
"blockvolume pod UID did not change across rollout restart",
"status-durable-after-blockvolume-restart.json",
"lifecycle-volumes.after-blockvolume-restart.json",
"blockvolume-generated.after-restart.log",
"--launcher-state-hostpath",
"--launcher-status",
} {
if !strings.Contains(body, want) {
t.Fatalf("app demo blockvolume restart path missing %q", want)
}
}
wrapper := readRepoFile(t, "scripts", "run-k8s-blockvolume-restart.sh")
for _, want := range []string{
`SW_BLOCK_LAUNCHER_STATE_HOSTPATH="${SW_BLOCK_LAUNCHER_STATE_HOSTPATH:-/var/lib/sw-block}"`,
"export SW_BLOCK_RESTART_BLOCKVOLUME_BEFORE_READER=1",
"demo-app-pvc-writer-hold-root.yaml",
"run-alpha-app-demo.sh",
} {
if !strings.Contains(wrapper, want) {
t.Fatalf("blockvolume restart wrapper missing %q:\n%s", want, wrapper)
}
}
}
func readRepoFile(t *testing.T, parts ...string) string {
t.Helper()
path := filepath.Join(append([]string{findRepoRoot(t)}, parts...)...)
raw, err := os.ReadFile(path)
if err != nil {
t.Fatalf("read %s: %v", path, err)
}
return string(raw)
}
@@ -0,0 +1,92 @@
param(
[string]$RunnerRoot = "",
[string]$OutputDir = "",
[string]$RepoUrl = "https://github.com/pingqiu/sw-test-runner.git",
[switch]$NoClone
)
$ErrorActionPreference = "Stop"
function RepoRoot {
return (Split-Path -Parent (Split-Path -Parent $PSScriptRoot))
}
function IsWindowsHost {
if ($env:OS -eq "Windows_NT") {
return $true
}
try {
return [System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform(
[System.Runtime.InteropServices.OSPlatform]::Windows)
} catch {
return $false
}
}
function HasSwblockSource([string]$Path) {
return $Path -and (Test-Path (Join-Path $Path "cmd/swblock/main.go"))
}
function RequireCommand([string]$Name) {
if (-not (Get-Command $Name -ErrorAction SilentlyContinue)) {
throw "missing required command: $Name"
}
}
$productRoot = RepoRoot
if (-not $OutputDir) {
$OutputDir = Join-Path $productRoot ".tools"
}
$candidates = @()
if ($RunnerRoot) {
$candidates += $RunnerRoot
}
if ($env:SW_TEST_RUNNER_ROOT) {
$candidates += $env:SW_TEST_RUNNER_ROOT
}
$candidates += (Join-Path (Split-Path -Parent $productRoot) "sw-test-runner")
$candidates += "C:\work\sw-test-runner"
$candidates += "C:\work\sw-test-runner-standalone"
$candidates += "C:\work\seaweedfs\learn\sw-test-runner-standalone"
$resolvedRunner = ""
foreach ($candidate in $candidates) {
if (HasSwblockSource $candidate) {
$resolvedRunner = (Resolve-Path $candidate).Path
break
}
}
if (-not $resolvedRunner) {
if ($NoClone) {
throw "sw-test-runner checkout not found. Set -RunnerRoot or SW_TEST_RUNNER_ROOT."
}
RequireCommand git
$cloneTarget = if ($RunnerRoot) { $RunnerRoot } else { Join-Path (Split-Path -Parent $productRoot) "sw-test-runner" }
if (Test-Path $cloneTarget) {
throw "candidate runner path exists but does not contain cmd/swblock/main.go: $cloneTarget"
}
Write-Host "[swblock-build] cloning $RepoUrl -> $cloneTarget"
git clone $RepoUrl $cloneTarget
$resolvedRunner = (Resolve-Path $cloneTarget).Path
}
RequireCommand go
New-Item -ItemType Directory -Force -Path $OutputDir | Out-Null
$exeName = if (IsWindowsHost) { "swblock.exe" } else { "swblock" }
$outPath = Join-Path $OutputDir $exeName
Write-Host "[swblock-build] runner_root=$resolvedRunner"
Write-Host "[swblock-build] output=$outPath"
Push-Location $resolvedRunner
try {
go build -o $outPath ./cmd/swblock
} finally {
Pop-Location
}
Set-Content -Path (Join-Path $OutputDir "swblock.path") -Value $outPath
Write-Output $outPath
+95
View File
@@ -0,0 +1,95 @@
#!/usr/bin/env bash
set -euo pipefail
RUNNER_ROOT="${SW_TEST_RUNNER_ROOT:-}"
OUTPUT_DIR=""
REPO_URL="${SW_TEST_RUNNER_REPO_URL:-https://github.com/pingqiu/sw-test-runner.git}"
NO_CLONE=0
usage() {
cat <<'USAGE'
usage: internal/tools/build-swblock.sh [--runner-root PATH] [--output-dir PATH] [--repo-url URL] [--no-clone]
Builds the sw-test-runner V3 binary (swblock) and prints the resulting path.
USAGE
}
while [[ $# -gt 0 ]]; do
case "$1" in
--runner-root)
RUNNER_ROOT="$2"
shift 2
;;
--output-dir)
OUTPUT_DIR="$2"
shift 2
;;
--repo-url)
REPO_URL="$2"
shift 2
;;
--no-clone)
NO_CLONE=1
shift
;;
-h|--help)
usage
exit 0
;;
*)
echo "unknown argument: $1" >&2
usage >&2
exit 2
;;
esac
done
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PRODUCT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
if [[ -z "$OUTPUT_DIR" ]]; then
OUTPUT_DIR="$PRODUCT_ROOT/.tools"
fi
has_swblock_source() {
[[ -n "$1" && -f "$1/cmd/swblock/main.go" ]]
}
RESOLVED_RUNNER=""
for candidate in \
"$RUNNER_ROOT" \
"$(cd "$PRODUCT_ROOT/.." && pwd)/sw-test-runner" \
"/c/work/sw-test-runner" \
"/c/work/sw-test-runner-standalone" \
"/c/work/seaweedfs/learn/sw-test-runner-standalone"
do
if has_swblock_source "$candidate"; then
RESOLVED_RUNNER="$(cd "$candidate" && pwd)"
break
fi
done
if [[ -z "$RESOLVED_RUNNER" ]]; then
if [[ "$NO_CLONE" == "1" ]]; then
echo "sw-test-runner checkout not found. Set --runner-root or SW_TEST_RUNNER_ROOT." >&2
exit 2
fi
command -v git >/dev/null 2>&1 || { echo "missing required command: git" >&2; exit 2; }
CLONE_TARGET="${RUNNER_ROOT:-$(cd "$PRODUCT_ROOT/.." && pwd)/sw-test-runner}"
if [[ -e "$CLONE_TARGET" ]]; then
echo "candidate runner path exists but lacks cmd/swblock/main.go: $CLONE_TARGET" >&2
exit 2
fi
echo "[swblock-build] cloning $REPO_URL -> $CLONE_TARGET"
git clone "$REPO_URL" "$CLONE_TARGET"
RESOLVED_RUNNER="$(cd "$CLONE_TARGET" && pwd)"
fi
command -v go >/dev/null 2>&1 || { echo "missing required command: go" >&2; exit 2; }
mkdir -p "$OUTPUT_DIR"
OUT_PATH="$OUTPUT_DIR/swblock"
echo "[swblock-build] runner_root=$RESOLVED_RUNNER"
echo "[swblock-build] output=$OUT_PATH"
(cd "$RESOLVED_RUNNER" && go build -o "$OUT_PATH" ./cmd/swblock)
printf '%s\n' "$OUT_PATH" >"$OUTPUT_DIR/swblock.path"
printf '%s\n' "$OUT_PATH"
+4 -4
View File
@@ -45,12 +45,12 @@ import_k3s_image() {
local image="$1"
local log_name="$2"
local -a ctr=()
if command -v k3s >/dev/null 2>&1 && k3s --version >/dev/null 2>&1; then
if command -v sudo >/dev/null 2>&1 && sudo -n k3s --version >/dev/null 2>&1; then
ctr=(sudo -n k3s ctr images import -)
elif command -v k3s >/dev/null 2>&1 && k3s --version >/dev/null 2>&1; then
ctr=(k3s ctr images import -)
elif command -v sudo >/dev/null 2>&1 && sudo k3s --version >/dev/null 2>&1; then
ctr=(sudo k3s ctr images import -)
else
echo "SW_BLOCK_IMPORT_K3S=1 requires k3s or sudo k3s on PATH" >&2
echo "SW_BLOCK_IMPORT_K3S=1 requires k3s or passwordless sudo k3s on PATH" >&2
exit 2
fi
@@ -6,6 +6,7 @@ ARTIFACT_DIR="${SW_BLOCK_ARTIFACT_DIR:-/tmp/sw-block-install-$(date -u +%Y%m%dT%
IMAGE="${SW_BLOCK_IMAGE:-ghcr.io/seaweedfs/seaweed-block:alpha}"
CSI_IMAGE="${SW_BLOCK_CSI_IMAGE:-ghcr.io/seaweedfs/seaweed-block-csi:alpha}"
LAUNCHER_PVC_OWNER_REF="${SW_BLOCK_LAUNCHER_PVC_OWNER_REF:-1}"
LAUNCHER_STATE_HOSTPATH="${SW_BLOCK_LAUNCHER_STATE_HOSTPATH:-}"
mkdir -p "$ARTIFACT_DIR"
@@ -46,6 +47,11 @@ if [[ "$LAUNCHER_PVC_OWNER_REF" == "1" || "$LAUNCHER_PVC_OWNER_REF" == "true" ]]
mv "$STACK_RENDERED.tmp" "$STACK_RENDERED"
grep -q -- '--launcher-pvc-owner-ref' "$STACK_RENDERED" || { echo "failed to inject --launcher-pvc-owner-ref into $STACK_RENDERED" >&2; exit 1; }
fi
if [[ -n "$LAUNCHER_STATE_HOSTPATH" ]]; then
SW_BLOCK_AWK_HOSTPATH="$LAUNCHER_STATE_HOSTPATH" awk 'BEGIN{hostpath=ENVIRON["SW_BLOCK_AWK_HOSTPATH"]; gsub(/\\/, "\\\\", hostpath); gsub(/"/, "\\\"", hostpath)} /--launcher-durable-root=/{print; print " - \"--launcher-state-hostpath=" hostpath "\""; next} {print}' "$STACK_RENDERED" >"$STACK_RENDERED.tmp"
mv "$STACK_RENDERED.tmp" "$STACK_RENDERED"
grep -q -- '--launcher-state-hostpath=' "$STACK_RENDERED" || { echo "failed to inject --launcher-state-hostpath into $STACK_RENDERED" >&2; exit 1; }
fi
sed -e "s/sw-block-csi:local/${CSI_IMAGE_SED}/g" \
-e "s/imagePullPolicy: Never/imagePullPolicy: IfNotPresent/g" \
"$ROOT/deploy/k8s/alpha/csi-controller.yaml" >"$CSI_CONTROLLER_RENDERED"
@@ -64,6 +70,7 @@ log "node=$NODE_NAME"
log "image=$IMAGE"
log "csi_image=$CSI_IMAGE"
log "launcher_pvc_owner_ref=$LAUNCHER_PVC_OWNER_REF"
log "launcher_state_hostpath=${LAUNCHER_STATE_HOSTPATH:-<emptyDir>}"
kubectl version --client=true >"$ARTIFACT_DIR/kubectl-version.txt" 2>&1 || true
kubectl get nodes -o wide >"$ARTIFACT_DIR/nodes.before.txt"
+212 -1
View File
@@ -8,7 +8,9 @@ POLL_LOG="$ARTIFACT_DIR/poll.log"
IMAGE="${SW_BLOCK_IMAGE:-sw-block:local}"
CSI_IMAGE="${SW_BLOCK_CSI_IMAGE:-sw-block-csi:local}"
LAUNCHER_PVC_OWNER_REF="${SW_BLOCK_LAUNCHER_PVC_OWNER_REF:-0}"
LAUNCHER_STATE_HOSTPATH="${SW_BLOCK_LAUNCHER_STATE_HOSTPATH:-}"
RESTART_CSI_NODE_BEFORE_READER="${SW_BLOCK_RESTART_CSI_NODE_BEFORE_READER:-0}"
RESTART_BLOCKVOLUME_BEFORE_READER="${SW_BLOCK_RESTART_BLOCKVOLUME_BEFORE_READER:-0}"
DEFAULT_DEMO_APP_MANIFEST="$ROOT/deploy/k8s/alpha/demo-app-pvc.yaml"
DEMO_APP_MANIFEST="${SW_BLOCK_DEMO_APP_MANIFEST:-$DEFAULT_DEMO_APP_MANIFEST}"
BLOCKVOLUME_NAMESPACE="kube-system"
@@ -21,6 +23,16 @@ if [[ "$RESTART_CSI_NODE_BEFORE_READER" == "1" || "$RESTART_CSI_NODE_BEFORE_READ
exit 2
fi
fi
if [[ "$RESTART_BLOCKVOLUME_BEFORE_READER" == "1" || "$RESTART_BLOCKVOLUME_BEFORE_READER" == "true" ]]; then
if [[ "$DEMO_APP_MANIFEST" == "$DEFAULT_DEMO_APP_MANIFEST" || "$(basename "$DEMO_APP_MANIFEST")" == "demo-app-pvc.yaml" ]]; then
echo "blockvolume restart mode requires a writer manifest that keeps the PVC mounted, e.g. deploy/k8s/alpha/demo-app-pvc-writer-hold.yaml" >&2
exit 2
fi
if [[ -z "$LAUNCHER_STATE_HOSTPATH" ]]; then
echo "blockvolume restart mode requires SW_BLOCK_LAUNCHER_STATE_HOSTPATH so generated blockvolume state is durable" >&2
exit 2
fi
fi
mkdir -p "$ARTIFACT_DIR"
@@ -85,6 +97,137 @@ collect_post_delete_state() {
fi
}
capture_iscsi_sessions_to() {
local path="$1"
if command -v sudo >/dev/null 2>&1; then
sudo iscsiadm -m session >"$path" 2>&1 || true
elif command -v iscsiadm >/dev/null 2>&1; then
iscsiadm -m session >"$path" 2>&1 || true
else
echo "iscsiadm unavailable" >"$path"
fi
}
wait_no_swblock_iscsi_sessions() {
local path="$1"
local timeout_s="$2"
for _ in $(seq 1 "$timeout_s"); do
capture_iscsi_sessions_to "$path"
if ! grep -q 'iqn.2026-05.io.seaweedfs' "$path" 2>/dev/null; then
return
fi
sleep 1
done
capture_iscsi_sessions_to "$path"
if grep -q 'iqn.2026-05.io.seaweedfs' "$path" 2>/dev/null; then
echo "sw-block iSCSI session still active before blockvolume restart" >&2
cat "$path" >&2 || true
exit 1
fi
}
capture_blockvolume_pod_ids() {
local path="$1"
kubectl -n "$BLOCKVOLUME_NAMESPACE" get pods -l sw-block.seaweedfs.com/volume -o jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.metadata.uid}{"\t"}{.status.startTime}{"\n"}{end}' >"$path" 2>&1 || true
}
wait_blockvolume_log_pattern() {
local deploy="$1"
local pattern="$2"
local out="$3"
local timeout_s="$4"
for _ in $(seq 1 "$timeout_s"); do
kubectl -n "$BLOCKVOLUME_NAMESPACE" logs "$deploy" -c blockvolume --tail=-1 >"$out" 2>&1 || true
if grep -F -q "$pattern" "$out" 2>/dev/null; then
return 0
fi
sleep 1
done
kubectl -n "$BLOCKVOLUME_NAMESPACE" logs "$deploy" -c blockvolume --tail=-1 >"$out" 2>&1 || true
echo "timed out waiting for blockvolume log pattern: $pattern" >&2
cat "$out" >&2 || true
exit 1
}
generated_blockvolume_arg() {
local name="$1"
sed -n "s/.*--${name}=\\([^\"[:space:]]*\\).*/\\1/p" "$ARTIFACT_DIR/generated-blockvolume.yaml" | head -n 1
}
wait_blockvolume_durable_status() {
local volume_id="$1"
local status_addr="$2"
local out="$3"
local timeout_s="$4"
local tmp="${out}.tmp"
if [[ -z "$volume_id" || -z "$status_addr" ]]; then
echo "missing blockvolume durable status input: volume_id=${volume_id:-<empty>} status_addr=${status_addr:-<empty>}" >&2
exit 1
fi
for _ in $(seq 1 "$timeout_s"); do
rm -f "$tmp"
if python3 - "$volume_id" "http://${status_addr}/status/durable?volume=${volume_id}" "$tmp" <<'PY'
import json
import sys
import urllib.request
volume_id, url, out = sys.argv[1:4]
try:
with urllib.request.urlopen(url, timeout=2) as resp:
raw = resp.read()
except Exception as exc:
print(f"status query failed: {exc}", file=sys.stderr)
sys.exit(1)
with open(out, "wb") as f:
f.write(raw)
body = json.loads(raw.decode("utf-8"))
if body.get("VolumeID") != volume_id:
print(f"status volume mismatch: {body.get('VolumeID')} != {volume_id}", file=sys.stderr)
sys.exit(2)
for vol in body.get("Volumes") or []:
if (
vol.get("VolumeID") == volume_id
and vol.get("Latched") is True
and vol.get("Operational") is True
and int(vol.get("Epoch") or 0) >= 1
and int(vol.get("EndpointVersion") or 0) >= 1
):
sys.exit(0)
print(f"durable status not ready: {body}", file=sys.stderr)
sys.exit(3)
PY
then
mv "$tmp" "$out"
return 0
fi
sleep 1
done
rm -f "$tmp"
python3 - "http://${status_addr}/status/durable?volume=${volume_id}" "$tmp" <<'PY' || true
import sys
import urllib.request
url, out = sys.argv[1:3]
try:
with urllib.request.urlopen(url, timeout=2) as resp:
raw = resp.read()
with open(out, "wb") as f:
f.write(raw)
print(raw.decode("utf-8", errors="replace"), file=sys.stderr)
except Exception as exc:
print(f"final status query failed: {exc}", file=sys.stderr)
PY
[[ -s "$tmp" ]] && mv "$tmp" "$out"
echo "timed out waiting for blockvolume durable status at ${status_addr}" >&2
exit 1
}
blockvolume_pod_uids() {
local path="$1"
awk 'NF >= 2 { print $2 }' "$path" | sort
}
cleanup() {
(
set +e
@@ -99,6 +242,17 @@ cleanup() {
kubectl delete -f "$ROOT/deploy/k8s/alpha/csi-driver.yaml" --ignore-not-found=true >>"$ARTIFACT_DIR/cleanup.log" 2>&1
kubectl delete -f "$ROOT/deploy/k8s/alpha/rbac.yaml" --ignore-not-found=true >>"$ARTIFACT_DIR/cleanup.log" 2>&1
kubectl delete -f "$STACK_RENDERED" --ignore-not-found=true >>"$ARTIFACT_DIR/cleanup.log" 2>&1
if [[ "$RESTART_BLOCKVOLUME_BEFORE_READER" == "1" || "$RESTART_BLOCKVOLUME_BEFORE_READER" == "true" ]]; then
case "$LAUNCHER_STATE_HOSTPATH" in
/var/lib/sw-block/testops-*)
if command -v sudo >/dev/null 2>&1; then
sudo rm -rf -- "$LAUNCHER_STATE_HOSTPATH" >>"$ARTIFACT_DIR/cleanup.log" 2>&1 || true
else
rm -rf -- "$LAUNCHER_STATE_HOSTPATH" >>"$ARTIFACT_DIR/cleanup.log" 2>&1 || true
fi
;;
esac
fi
)
}
@@ -156,6 +310,16 @@ if [[ "$BLOCKVOLUME_NAMESPACE" != "kube-system" ]]; then
mv "$STACK_RENDERED.tmp" "$STACK_RENDERED"
grep -q -- '--launcher-pvc-owner-ref' "$STACK_RENDERED" || { echo "failed to inject --launcher-pvc-owner-ref into $STACK_RENDERED" >&2; exit 1; }
fi
if [[ -n "$LAUNCHER_STATE_HOSTPATH" ]]; then
awk -v hostpath="$LAUNCHER_STATE_HOSTPATH" '/--launcher-durable-root=/{print; print " - \"--launcher-state-hostpath=" hostpath "\""; next} {print}' "$STACK_RENDERED" >"$STACK_RENDERED.tmp"
mv "$STACK_RENDERED.tmp" "$STACK_RENDERED"
grep -q -- '--launcher-state-hostpath=' "$STACK_RENDERED" || { echo "failed to inject --launcher-state-hostpath into $STACK_RENDERED" >&2; exit 1; }
fi
if [[ "$RESTART_BLOCKVOLUME_BEFORE_READER" == "1" || "$RESTART_BLOCKVOLUME_BEFORE_READER" == "true" ]]; then
awk '/--launcher-durable-root=/{print; print " - \"--launcher-status\""; next} {print}' "$STACK_RENDERED" >"$STACK_RENDERED.tmp"
mv "$STACK_RENDERED.tmp" "$STACK_RENDERED"
grep -q -- '--launcher-status' "$STACK_RENDERED" || { echo "failed to inject --launcher-status into $STACK_RENDERED" >&2; exit 1; }
fi
sed -e "s/sw-block-csi:local/${CSI_IMAGE_SED}/g" \
-e "s/imagePullPolicy: Never/imagePullPolicy: IfNotPresent/g" \
"$ROOT/deploy/k8s/alpha/csi-controller.yaml" >"$CSI_CONTROLLER_RENDERED"
@@ -176,7 +340,9 @@ log "image=$IMAGE"
log "csi_image=$CSI_IMAGE"
log "blockvolume_namespace=$BLOCKVOLUME_NAMESPACE"
log "launcher_pvc_owner_ref=$LAUNCHER_PVC_OWNER_REF"
log "launcher_state_hostpath=${LAUNCHER_STATE_HOSTPATH:-<emptyDir>}"
log "restart_csi_node_before_reader=$RESTART_CSI_NODE_BEFORE_READER"
log "restart_blockvolume_before_reader=$RESTART_BLOCKVOLUME_BEFORE_READER"
log "demo_app_manifest=$DEMO_APP_MANIFEST"
kubectl version --client=true >"$ARTIFACT_DIR/kubectl-version.txt" 2>&1 || true
kubectl get nodes -o wide >"$ARTIFACT_DIR/nodes.before.txt"
@@ -217,12 +383,13 @@ kubectl apply -f "$ARTIFACT_DIR/generated-blockvolume.yaml" | tee "$ARTIFACT_DIR
kubectl -n "$BLOCKVOLUME_NAMESPACE" wait --for=condition=available deploy -l app=sw-blockvolume --timeout=120s
log "wait for app writer completion"
if [[ "$RESTART_CSI_NODE_BEFORE_READER" == "1" || "$RESTART_CSI_NODE_BEFORE_READER" == "true" ]]; then
if [[ "$RESTART_CSI_NODE_BEFORE_READER" == "1" || "$RESTART_CSI_NODE_BEFORE_READER" == "true" || "$RESTART_BLOCKVOLUME_BEFORE_READER" == "1" || "$RESTART_BLOCKVOLUME_BEFORE_READER" == "true" ]]; then
wait_pod_log_contains sw-block-demo-writer "[app-writer] wrote and verified /data/demo.bin" 240
else
wait_pod_succeeded sw-block-demo-writer 240
fi
kubectl -n "$NAMESPACE" logs sw-block-demo-writer | tee "$ARTIFACT_DIR/writer.log"
kubectl -n "$NAMESPACE" describe pod sw-block-demo-writer >"$ARTIFACT_DIR/writer.describe.before-delete.txt" 2>&1 || true
if [[ "$RESTART_CSI_NODE_BEFORE_READER" == "1" || "$RESTART_CSI_NODE_BEFORE_READER" == "true" ]]; then
log "restart CSI node DaemonSet before replacing the app pod"
@@ -231,13 +398,57 @@ if [[ "$RESTART_CSI_NODE_BEFORE_READER" == "1" || "$RESTART_CSI_NODE_BEFORE_READ
kubectl -n kube-system get pods -l app=sw-block-csi-node -o wide >"$ARTIFACT_DIR/csi-node-pods.after-restart.txt" 2>&1 || true
fi
restart_blockvolume_deployment() {
log "restart generated blockvolume Deployment before replacing the app pod"
BLOCKVOLUME_DEPLOY="$(kubectl -n "$BLOCKVOLUME_NAMESPACE" get deploy -l app=sw-blockvolume -o name | head -n 1)"
if [[ -z "$BLOCKVOLUME_DEPLOY" ]]; then
echo "generated blockvolume Deployment not found before restart" >&2
exit 1
fi
echo "$BLOCKVOLUME_DEPLOY" >"$ARTIFACT_DIR/blockvolume-deploy.before-restart.txt"
kubectl -n "$BLOCKVOLUME_NAMESPACE" get "$BLOCKVOLUME_DEPLOY" -o yaml >"$ARTIFACT_DIR/blockvolume-deploy.before-restart.yaml"
kubectl -n "$BLOCKVOLUME_NAMESPACE" get pods -l sw-block.seaweedfs.com/volume -o wide >"$ARTIFACT_DIR/blockvolume-pods.before-restart.txt" 2>&1 || true
capture_blockvolume_pod_ids "$ARTIFACT_DIR/blockvolume-pod-ids.before-restart.tsv"
if [[ -z "$(blockvolume_pod_uids "$ARTIFACT_DIR/blockvolume-pod-ids.before-restart.tsv")" ]]; then
echo "no blockvolume pod UID captured before restart" >&2
exit 1
fi
kubectl -n "$BLOCKVOLUME_NAMESPACE" rollout restart "$BLOCKVOLUME_DEPLOY" | tee "$ARTIFACT_DIR/restart-blockvolume.log"
kubectl -n "$BLOCKVOLUME_NAMESPACE" rollout status "$BLOCKVOLUME_DEPLOY" --timeout=180s | tee "$ARTIFACT_DIR/restart-blockvolume-status.log"
kubectl -n "$BLOCKVOLUME_NAMESPACE" get pods -l sw-block.seaweedfs.com/volume -o wide >"$ARTIFACT_DIR/blockvolume-pods.after-restart.txt" 2>&1 || true
capture_blockvolume_pod_ids "$ARTIFACT_DIR/blockvolume-pod-ids.after-restart.tsv"
if [[ -z "$(blockvolume_pod_uids "$ARTIFACT_DIR/blockvolume-pod-ids.after-restart.tsv")" ]]; then
echo "no blockvolume pod UID captured after restart" >&2
exit 1
fi
if [[ "$(blockvolume_pod_uids "$ARTIFACT_DIR/blockvolume-pod-ids.before-restart.tsv")" == "$(blockvolume_pod_uids "$ARTIFACT_DIR/blockvolume-pod-ids.after-restart.tsv")" ]]; then
echo "blockvolume pod UID did not change across rollout restart" >&2
exit 1
fi
kubectl -n kube-system exec deploy/sw-blockmaster -c blockmaster -- sh -c 'cat /var/lib/sw-block/lifecycle/volumes/*.json' >"$ARTIFACT_DIR/lifecycle-volumes.after-blockvolume-restart.json" 2>"$ARTIFACT_DIR/lifecycle-volumes.after-blockvolume-restart.err" || true
BLOCKVOLUME_VOLUME_ID="$(generated_blockvolume_arg "volume-id")"
BLOCKVOLUME_STATUS_ADDR="$(generated_blockvolume_arg "status-addr")"
echo "$BLOCKVOLUME_STATUS_ADDR" >"$ARTIFACT_DIR/blockvolume-status-addr.txt"
wait_blockvolume_durable_status "$BLOCKVOLUME_VOLUME_ID" "$BLOCKVOLUME_STATUS_ADDR" "$ARTIFACT_DIR/status-durable-after-blockvolume-restart.json" 120
wait_blockvolume_log_pattern "$BLOCKVOLUME_DEPLOY" "\"phase\":\"iscsi-listening\"" "$ARTIFACT_DIR/blockvolume-generated.after-restart.log" 120
}
log "delete writer pod but keep PVC"
kubectl -n "$NAMESPACE" delete pod sw-block-demo-writer --wait=true --timeout=120s | tee "$ARTIFACT_DIR/delete-writer.log"
if [[ "$RESTART_BLOCKVOLUME_BEFORE_READER" == "1" || "$RESTART_BLOCKVOLUME_BEFORE_READER" == "true" ]]; then
log "wait for writer unstage before blockvolume restart"
wait_no_swblock_iscsi_sessions "$ARTIFACT_DIR/iscsi-sessions.before-blockvolume-restart.txt" 120
restart_blockvolume_deployment
fi
log "start reader pod on the same PVC"
kubectl apply -f "$ROOT/deploy/k8s/alpha/demo-app-reader-pod.yaml" | tee "$ARTIFACT_DIR/apply-reader.log"
wait_pod_succeeded sw-block-demo-reader 240
kubectl -n "$NAMESPACE" logs sw-block-demo-reader | tee "$ARTIFACT_DIR/reader.log"
kubectl -n "$NAMESPACE" describe pod sw-block-demo-reader >"$ARTIFACT_DIR/reader.describe.before-delete.txt" 2>&1 || true
capture_iscsi_sessions_to "$ARTIFACT_DIR/iscsi-sessions.after-reader.txt"
kubectl -n kube-system logs -l app=sw-block-csi-node -c block-csi --tail=-1 >"$ARTIFACT_DIR/blockcsi-node.log" 2>&1 || true
log "reader verified data written by previous app pod"
@@ -18,6 +18,7 @@ DYNAMIC_PVC_MANIFEST="${SW_BLOCK_DYNAMIC_PVC_MANIFEST:-$ROOT/deploy/k8s/g15d/dyn
IMAGE="${SW_BLOCK_IMAGE:-sw-block:local}"
CSI_IMAGE="${SW_BLOCK_CSI_IMAGE:-sw-block-csi:local}"
LAUNCHER_PVC_OWNER_REF="${SW_BLOCK_LAUNCHER_PVC_OWNER_REF:-0}"
LAUNCHER_STATE_HOSTPATH="${SW_BLOCK_LAUNCHER_STATE_HOSTPATH:-}"
CHAP_USERNAME="${SW_BLOCK_ISCSI_CHAP_USERNAME:-}"
CHAP_SECRET="${SW_BLOCK_ISCSI_CHAP_SECRET:-}"
CHAP_SECRET_NAME="${SW_BLOCK_ISCSI_CHAP_SECRET_NAME:-sw-block-iscsi-chap}"
@@ -107,6 +108,11 @@ if [[ "$BLOCKVOLUME_NAMESPACE" != "kube-system" ]]; then
mv "$STACK_RENDERED.tmp" "$STACK_RENDERED"
grep -q -- '--launcher-pvc-owner-ref' "$STACK_RENDERED" || { echo "failed to inject --launcher-pvc-owner-ref into $STACK_RENDERED" >&2; exit 1; }
fi
if [[ -n "$LAUNCHER_STATE_HOSTPATH" ]]; then
SW_BLOCK_AWK_HOSTPATH="$LAUNCHER_STATE_HOSTPATH" awk 'BEGIN{hostpath=ENVIRON["SW_BLOCK_AWK_HOSTPATH"]; gsub(/\\/, "\\\\", hostpath); gsub(/"/, "\\\"", hostpath)} /--launcher-durable-root=/{print; print " - \"--launcher-state-hostpath=" hostpath "\""; next} {print}' "$STACK_RENDERED" >"$STACK_RENDERED.tmp"
mv "$STACK_RENDERED.tmp" "$STACK_RENDERED"
grep -q -- '--launcher-state-hostpath=' "$STACK_RENDERED" || { echo "failed to inject --launcher-state-hostpath into $STACK_RENDERED" >&2; exit 1; }
fi
if [[ "$CHAP_ENABLED" == "1" ]]; then
awk -v secret="$CHAP_SECRET_NAME" '/--launcher-iscsi-port-base=/{print; print " - \"--launcher-iscsi-chap-secret-name=" secret "\""; next} {print}' "$STACK_RENDERED" >"$STACK_RENDERED.tmp"
mv "$STACK_RENDERED.tmp" "$STACK_RENDERED"
@@ -160,6 +166,7 @@ log "image=$IMAGE"
log "csi_image=$CSI_IMAGE"
log "blockvolume_namespace=$BLOCKVOLUME_NAMESPACE"
log "launcher_pvc_owner_ref=$LAUNCHER_PVC_OWNER_REF"
log "launcher_state_hostpath=${LAUNCHER_STATE_HOSTPATH:-<emptyDir>}"
log "chap_enabled=$CHAP_ENABLED"
log "frontend_protocol=$FRONTEND_PROTOCOL"
log "expected_git_revision=${EXPECTED_GIT_REVISION:-unknown}"
@@ -17,6 +17,10 @@ R2_CTRL_ADDR="${SW_BLOCK_R2_CTRL_ADDR:-127.0.0.1:19612}"
R2_STATUS_ADDR="${SW_BLOCK_R2_STATUS_ADDR:-127.0.0.1:19613}"
BLOCKS="${SW_BLOCK_DURABLE_BLOCKS:-65536}"
BLOCK_SIZE="${SW_BLOCK_DURABLE_BLOCKSIZE:-4096}"
RETURN_R1_AFTER_FAILOVER="${SW_BLOCK_RETURN_R1_AFTER_FAILOVER:-0}"
DEGRADED_PROBE_INTERVAL="${SW_BLOCK_DEGRADED_PROBE_INTERVAL:-0}"
DEGRADED_PROBE_COOLDOWN_BASE="${SW_BLOCK_DEGRADED_PROBE_COOLDOWN_BASE:-1s}"
DEGRADED_PROBE_COOLDOWN_CAP="${SW_BLOCK_DEGRADED_PROBE_COOLDOWN_CAP:-3s}"
BIN_DIR="${SW_BLOCK_BIN_DIR:-${WORK_DIR}/bin}"
RUN_DIR="${WORK_DIR}/run"
MOUNT_DIR="${SW_BLOCK_ISCSI_MOUNT_DIR:-${WORK_DIR}/mnt}"
@@ -79,6 +83,8 @@ log "root=$ROOT"
log "artifact_dir=$ARTIFACT_DIR"
log "iqn=$IQN"
log "portals=$(portal_for "$PORT1"),$(portal_for "$PORT2")"
log "return_r1_after_failover=$RETURN_R1_AFTER_FAILOVER"
log "degraded_probe_interval=$DEGRADED_PROBE_INTERVAL"
cd "$ROOT"
git rev-parse --short HEAD >"$ARTIFACT_DIR/git-head.txt" 2>/dev/null || true
@@ -132,6 +138,15 @@ start_blockvolume() {
local store="$7"
local log_file="$8"
local extra_args=()
if [[ "$DEGRADED_PROBE_INTERVAL" != "0" && "$DEGRADED_PROBE_INTERVAL" != "0s" ]]; then
extra_args+=(
--degraded-probe-interval "$DEGRADED_PROBE_INTERVAL"
--degraded-probe-cooldown-base "$DEGRADED_PROBE_COOLDOWN_BASE"
--degraded-probe-cooldown-cap "$DEGRADED_PROBE_COOLDOWN_CAP"
)
fi
setsid -f "${BIN_DIR}/blockvolume" \
--master "$MASTER_ADDR" \
--server-id "$server" \
@@ -148,6 +163,7 @@ start_blockvolume() {
--durable-blocksize "$BLOCK_SIZE" \
--iscsi-listen "127.0.0.1:${port}" \
--iscsi-iqn "$IQN" \
"${extra_args[@]}" \
>"$log_file" 2>&1
}
@@ -220,6 +236,151 @@ PY
exit 1
}
wait_status_returned() {
local status_addr="$1"
local replica="$2"
local out="$ARTIFACT_DIR/status-${replica}-returned.json"
for _ in $(seq 1 240); do
if curl -fsS "http://${status_addr}/status?volume=v1" >"$out.tmp" 2>/dev/null; then
if python3 - "$out.tmp" "$replica" <<'PY'
import json, sys
path, replica = sys.argv[1], sys.argv[2]
body = json.load(open(path))
if str(body.get("ReplicaID", "")) != replica:
sys.exit(1)
authority_role = str(body.get("AuthorityRole", ""))
replication_role = str(body.get("ReplicationRole", ""))
frontend_ready = bool(body.get("FrontendPrimaryReady"))
healthy = bool(body.get("Healthy"))
ok_role = authority_role != "primary" and replication_role in ("not_ready", "recovering", "replica_ready")
ok = ok_role and not frontend_ready and not healthy
sys.exit(0 if ok else 1)
PY
then
mv "$out.tmp" "$out"
{
echo "replica=${replica}"
echo "authority_non_primary=true"
echo "frontend_primary_ready=false"
echo "healthy=false"
} >"$ARTIFACT_DIR/status-${replica}-returned.summary"
return 0
fi
fi
sleep 0.25
done
curl -fsS "http://${status_addr}/status?volume=v1" >"$ARTIFACT_DIR/status-${replica}-returned-last.json" 2>/dev/null || true
echo "timed out waiting for ${replica} returned non-frontend projection" >&2
exit 1
}
wait_durable_ready() {
local status_addr="$1"
local replica="$2"
local min_epoch="$3"
local suffix="$4"
local out="$ARTIFACT_DIR/status-durable-${replica}-${suffix}.json"
for _ in $(seq 1 240); do
if curl -fsS "http://${status_addr}/status/durable?volume=v1" >"$out.tmp" 2>/dev/null; then
if python3 - "$out.tmp" "$replica" "$min_epoch" <<'PY'
import json, sys
path, replica, min_epoch = sys.argv[1], sys.argv[2], int(sys.argv[3])
body = json.load(open(path))
if str(body.get("ReplicaID", "")) != replica:
sys.exit(1)
vols = body.get("Volumes", [])
if not vols:
sys.exit(1)
for v in vols:
if str(v.get("VolumeID", "")) != "v1" or str(v.get("ReplicaID", "")) != replica:
continue
epoch = int(v.get("Epoch", 0))
latched = bool(v.get("Latched"))
operational = bool(v.get("Operational"))
closed = bool(v.get("Closed"))
evidence = str(v.get("Evidence", ""))
ok = epoch >= min_epoch and latched and operational and not closed and evidence != ""
sys.exit(0 if ok else 1)
sys.exit(1)
PY
then
mv "$out.tmp" "$out"
python3 - "$out" "$replica" "$min_epoch" >"$ARTIFACT_DIR/status-durable-${replica}-${suffix}.summary" <<'PY'
import json, sys
path, replica, min_epoch = sys.argv[1], sys.argv[2], int(sys.argv[3])
body = json.load(open(path))
for v in body.get("Volumes", []):
if str(v.get("VolumeID", "")) == "v1" and str(v.get("ReplicaID", "")) == replica:
epoch = int(v.get("Epoch", 0))
print(f"replica={replica}")
print(f"epoch={epoch}")
print(f"epoch_gte_{min_epoch}={str(epoch >= min_epoch).lower()}")
print(f"latched={str(bool(v.get('Latched'))).lower()}")
print(f"operational={str(bool(v.get('Operational'))).lower()}")
print(f"closed={str(bool(v.get('Closed'))).lower()}")
sys.exit(0)
sys.exit(1)
PY
return 0
fi
fi
sleep 0.25
done
curl -fsS "http://${status_addr}/status/durable?volume=v1" >"$ARTIFACT_DIR/status-durable-${replica}-${suffix}-last.json" 2>/dev/null || true
echo "timed out waiting for ${replica} durable ready status" >&2
exit 1
}
capture_durable_status() {
local status_addr="$1"
local replica="$2"
local suffix="$3"
local out="$ARTIFACT_DIR/status-durable-${replica}-${suffix}.json"
for _ in $(seq 1 40); do
if curl -fsS "http://${status_addr}/status/durable?volume=v1" >"$out.tmp" 2>/dev/null; then
mv "$out.tmp" "$out"
return 0
fi
sleep 0.25
done
echo "failed to capture ${replica} durable status" >&2
exit 1
}
wait_peer_healthy() {
local status_addr="$1"
local peer="$2"
local min_epoch="$3"
local out="$ARTIFACT_DIR/status-r2-peers-after-${peer}-return.json"
for _ in $(seq 1 240); do
if curl -fsS "http://${status_addr}/status/peers?volume=v1" >"$out.tmp" 2>/dev/null; then
if python3 - "$out.tmp" "$peer" "$min_epoch" <<'PY'
import json, sys
path, peer, min_epoch = sys.argv[1], sys.argv[2], int(sys.argv[3])
body = json.load(open(path))
for p in body.get("Peers", []):
if str(p.get("ReplicaID", "")) != peer:
continue
state = str(p.get("State", ""))
epoch = int(p.get("Epoch", 0))
in_flight = bool(p.get("ProbeInFlight"))
closed = bool(p.get("Closed"))
ok = state == "healthy" and epoch >= min_epoch and not in_flight and not closed
sys.exit(0 if ok else 1)
sys.exit(1)
PY
then
mv "$out.tmp" "$out"
return 0
fi
fi
sleep 0.25
done
curl -fsS "http://${status_addr}/status/peers?volume=v1" >"$ARTIFACT_DIR/status-r2-peers-after-${peer}-return-last.json" 2>/dev/null || true
echo "timed out waiting for primary peer ${peer} healthy" >&2
exit 1
}
wait_log_pattern() {
local path="$1"
local pattern="$2"
@@ -385,6 +546,20 @@ fi
sudo sha256sum "$MOUNT_DIR/post.bin" | tee "$ARTIFACT_DIR/post.sha256"
sudo sha256sum -c "$ARTIFACT_DIR/post.sha256" | tee "$ARTIFACT_DIR/post-check.log"
if [[ "$RETURN_R1_AFTER_FAILOVER" == "1" || "$RETURN_R1_AFTER_FAILOVER" == "true" ]]; then
log "restart returned r1 after r2 promotion"
start_blockvolume r1 s1 "$PORT1" "$R1_DATA_ADDR" "$R1_CTRL_ADDR" "$R1_STATUS_ADDR" \
"${RUN_DIR}/r1-store" "$ARTIFACT_DIR/blockvolume-r1-returned.log"
wait_port "$PORT1"
wait_status_returned "$R1_STATUS_ADDR" r1
wait_log_pattern "$ARTIFACT_DIR/blockvolume-r1-returned.log" "authority is now .*not this replica" "r1 returned authority observation"
wait_log_pattern "$ARTIFACT_DIR/blockvolume-r1-returned.log" "durable recovered: recovered LSN=" "r1 returned local recovery"
wait_peer_healthy "$R2_STATUS_ADDR" r1 2
capture_durable_status "$R1_STATUS_ADDR" r1 "returned"
wait_durable_ready "$R2_STATUS_ADDR" r2 2 "primary-after-r1-return"
curl -fsS "http://${R2_STATUS_ADDR}/status?volume=v1" >"$ARTIFACT_DIR/status-r2-after-r1-return.json" 2>/dev/null || true
fi
log "unmount"
sudo umount "$MOUNT_DIR"
+52 -20
View File
@@ -7,6 +7,10 @@ WORK_DIR="${SW_BLOCK_ISCSI_WORK_DIR:-/tmp/sw-block-iscsi-os}"
ARTIFACT_DIR="${SW_BLOCK_ARTIFACT_DIR:-${WORK_DIR}/runs/${RUN_ID}}"
IQN="${SW_BLOCK_ISCSI_IQN:-iqn.2026-05.io.seaweedfs:os-smoke-v1}"
PORTAL_ADDR="${SW_BLOCK_ISCSI_PORTAL_ADDR:-}"
LISTEN_HOST="${SW_BLOCK_ISCSI_LISTEN_HOST:-127.0.0.1}"
INITIATOR_PORTAL_ADDR="${SW_BLOCK_ISCSI_INITIATOR_PORTAL_ADDR:-}"
TARGET_ONLY="${SW_BLOCK_ISCSI_TARGET_ONLY:-0}"
TARGET_HOLD_SECONDS="${SW_BLOCK_ISCSI_TARGET_HOLD_SECONDS:-900}"
DATAOUT_TIMEOUT="${SW_BLOCK_ISCSI_DATAOUT_TIMEOUT:-}"
CHAP_USERNAME="${SW_BLOCK_ISCSI_CHAP_USERNAME:-}"
CHAP_SECRET="${SW_BLOCK_ISCSI_CHAP_SECRET:-}"
@@ -57,11 +61,19 @@ PY
}
PORT="${SW_BLOCK_ISCSI_PORT:-$(pick_free_port)}"
if [[ -z "$INITIATOR_PORTAL_ADDR" ]]; then
INITIATOR_PORTAL_ADDR="127.0.0.1:${PORT}"
fi
INITIATOR_PORTAL_HOST="${INITIATOR_PORTAL_ADDR%%:*}"
LISTENER_CHECK_HOST="$LISTEN_HOST"
if [[ "$LISTENER_CHECK_HOST" == "0.0.0.0" ]]; then
LISTENER_CHECK_HOST="127.0.0.1"
fi
MASTER_ADDR="${SW_BLOCK_MASTER_ADDR:-127.0.0.1:$(pick_free_port)}"
DATA_ADDR="${SW_BLOCK_DATA_ADDR:-127.0.0.1:$(pick_free_port)}"
CTRL_ADDR="${SW_BLOCK_CTRL_ADDR:-127.0.0.1:$(pick_free_port)}"
STATUS_ADDR="${SW_BLOCK_STATUS_ADDR:-127.0.0.1:$(pick_free_port)}"
DEVLINK_GLOB="/dev/disk/by-path/*ip-127.0.0.1:${PORT}-iscsi-${IQN}-lun-0"
DEVLINK_GLOB="/dev/disk/by-path/*ip-${INITIATOR_PORTAL_HOST}:${PORT}-iscsi-${IQN}-lun-0"
MASTER_PID=""
VOLUME_PID=""
@@ -95,9 +107,9 @@ cleanup() {
log "cleanup"
mountpoint -q "$MOUNT_DIR" && sudo umount "$MOUNT_DIR" >>"$ARTIFACT_DIR/cleanup.log" 2>&1
cleanup_iqn_records
sudo iscsiadm -m node -T "$IQN" -p "127.0.0.1:${PORT}" --logout >>"$ARTIFACT_DIR/cleanup.log" 2>&1 || true
sudo iscsiadm -m node -T "$IQN" -p "127.0.0.1:${PORT}" -o delete >>"$ARTIFACT_DIR/cleanup.log" 2>&1 || true
sudo iscsiadm -m discoverydb -t sendtargets -p "127.0.0.1:${PORT}" -o delete >>"$ARTIFACT_DIR/cleanup.log" 2>&1 || true
sudo iscsiadm -m node -T "$IQN" -p "$INITIATOR_PORTAL_ADDR" --logout >>"$ARTIFACT_DIR/cleanup.log" 2>&1 || true
sudo iscsiadm -m node -T "$IQN" -p "$INITIATOR_PORTAL_ADDR" -o delete >>"$ARTIFACT_DIR/cleanup.log" 2>&1 || true
sudo iscsiadm -m discoverydb -t sendtargets -p "$INITIATOR_PORTAL_ADDR" -o delete >>"$ARTIFACT_DIR/cleanup.log" 2>&1 || true
[[ -n "$VOLUME_PID" ]] && kill "$VOLUME_PID" >>"$ARTIFACT_DIR/cleanup.log" 2>&1 || true
[[ -n "$MASTER_PID" ]] && kill "$MASTER_PID" >>"$ARTIFACT_DIR/cleanup.log" 2>&1 || true
pkill -TERM -f "${BIN_DIR}/blockvolume" >>"$ARTIFACT_DIR/cleanup.log" 2>&1 || true
@@ -124,7 +136,8 @@ log "run_id=$RUN_ID"
log "root=$ROOT"
log "artifact_dir=$ARTIFACT_DIR"
log "iqn=$IQN"
log "portal=127.0.0.1:${PORT}"
log "portal=${INITIATOR_PORTAL_ADDR}"
log "listen=${LISTEN_HOST}:${PORT}"
log "master=${MASTER_ADDR}"
log "data_addr=${DATA_ADDR}"
log "ctrl_addr=${CTRL_ADDR}"
@@ -178,6 +191,9 @@ cleanup_iqn_records
sudo iscsiadm -m node -T "$IQN" -p "127.0.0.1:${PORT}" --logout >/dev/null 2>&1 || true
sudo iscsiadm -m node -T "$IQN" -p "127.0.0.1:${PORT}" -o delete >/dev/null 2>&1 || true
sudo iscsiadm -m discoverydb -t sendtargets -p "127.0.0.1:${PORT}" -o delete >/dev/null 2>&1 || true
sudo iscsiadm -m node -T "$IQN" -p "$INITIATOR_PORTAL_ADDR" --logout >/dev/null 2>&1 || true
sudo iscsiadm -m node -T "$IQN" -p "$INITIATOR_PORTAL_ADDR" -o delete >/dev/null 2>&1 || true
sudo iscsiadm -m discoverydb -t sendtargets -p "$INITIATOR_PORTAL_ADDR" -o delete >/dev/null 2>&1 || true
sudo iscsiadm -m session >"$ARTIFACT_DIR/iscsi-sessions.before.txt" 2>&1 || true
log "start blockmaster"
@@ -208,7 +224,7 @@ fi
log "start blockvolume iSCSI target"
blockvolume_iscsi_args=(
--iscsi-listen "127.0.0.1:${PORT}"
--iscsi-listen "${LISTEN_HOST}:${PORT}"
--iscsi-iqn "$IQN"
)
if [[ -n "$PORTAL_ADDR" ]]; then
@@ -247,42 +263,58 @@ for _ in $(seq 1 100); do
echo "blockvolume exited during startup" >&2
exit 1
fi
if bash -c "</dev/tcp/127.0.0.1/${PORT}" >/dev/null 2>&1; then
if bash -c "</dev/tcp/${LISTENER_CHECK_HOST}/${PORT}" >/dev/null 2>&1; then
break
fi
sleep 0.1
done
if ! bash -c "</dev/tcp/127.0.0.1/${PORT}" >/dev/null 2>&1; then
if ! bash -c "</dev/tcp/${LISTENER_CHECK_HOST}/${PORT}" >/dev/null 2>&1; then
cat "$ARTIFACT_DIR/blockvolume.log" >&2 || true
echo "iSCSI listener did not open on 127.0.0.1:${PORT}" >&2
echo "iSCSI listener did not open on ${LISTEN_HOST}:${PORT}" >&2
exit 1
fi
sleep 2
if [[ "$TARGET_ONLY" == "1" ]]; then
cat >"$ARTIFACT_DIR/target-ready.env" <<ENV
SW_BLOCK_ISCSI_TARGET_READY=1
SW_BLOCK_ISCSI_IQN=${IQN}
SW_BLOCK_ISCSI_PORTAL=${PORTAL_ADDR:-${INITIATOR_PORTAL_ADDR}}
SW_BLOCK_ISCSI_LISTEN=${LISTEN_HOST}:${PORT}
SW_BLOCK_ISCSI_ARTIFACT_DIR=${ARTIFACT_DIR}
ENV
log "target-only mode: hold ${TARGET_HOLD_SECONDS}s for external initiator"
log "target-only portal=${PORTAL_ADDR:-${INITIATOR_PORTAL_ADDR}} iqn=${IQN}"
log "target-only ready_file=${ARTIFACT_DIR}/target-ready.env"
sleep "$TARGET_HOLD_SECONDS"
log "target-only hold complete"
exit 0
fi
run_iteration() {
local iter="$1"
local suffix="iter${iter}"
log "iteration ${iter}: iscsi discovery/login"
if [[ -n "$CHAP_SECRET" ]]; then
sudo iscsiadm -m discovery -t sendtargets -p "127.0.0.1:${PORT}" | tee "$ARTIFACT_DIR/discovery.${suffix}.log"
sudo iscsiadm -m node -T "$IQN" -p "127.0.0.1:${PORT}" --op=update -n node.session.auth.authmethod -v CHAP >>"$ARTIFACT_DIR/node-auth.${suffix}.log" 2>&1
sudo iscsiadm -m node -T "$IQN" -p "127.0.0.1:${PORT}" --op=update -n node.session.auth.username -v "$CHAP_USERNAME" >>"$ARTIFACT_DIR/node-auth.${suffix}.log" 2>&1
sudo iscsiadm -m node -T "$IQN" -p "127.0.0.1:${PORT}" --op=update -n node.session.auth.password -v "$CHAP_SECRET" >>"$ARTIFACT_DIR/node-auth.${suffix}.log" 2>&1
sudo iscsiadm -m discovery -t sendtargets -p "$INITIATOR_PORTAL_ADDR" | tee "$ARTIFACT_DIR/discovery.${suffix}.log"
sudo iscsiadm -m node -T "$IQN" -p "$INITIATOR_PORTAL_ADDR" --op=update -n node.session.auth.authmethod -v CHAP >>"$ARTIFACT_DIR/node-auth.${suffix}.log" 2>&1
sudo iscsiadm -m node -T "$IQN" -p "$INITIATOR_PORTAL_ADDR" --op=update -n node.session.auth.username -v "$CHAP_USERNAME" >>"$ARTIFACT_DIR/node-auth.${suffix}.log" 2>&1
sudo iscsiadm -m node -T "$IQN" -p "$INITIATOR_PORTAL_ADDR" --op=update -n node.session.auth.password -v "$CHAP_SECRET" >>"$ARTIFACT_DIR/node-auth.${suffix}.log" 2>&1
if [[ "$iter" == "1" && -n "$CHAP_BAD_SECRET" ]]; then
log "iteration ${iter}: verify wrong CHAP secret fails"
sudo iscsiadm -m node -T "$IQN" -p "127.0.0.1:${PORT}" --op=update -n node.session.auth.password -v "$CHAP_BAD_SECRET" >>"$ARTIFACT_DIR/node-auth-bad.${suffix}.log" 2>&1
if sudo iscsiadm -m node -T "$IQN" -p "127.0.0.1:${PORT}" --login >"$ARTIFACT_DIR/login-bad.${suffix}.log" 2>&1; then
sudo iscsiadm -m node -T "$IQN" -p "$INITIATOR_PORTAL_ADDR" --op=update -n node.session.auth.password -v "$CHAP_BAD_SECRET" >>"$ARTIFACT_DIR/node-auth-bad.${suffix}.log" 2>&1
if sudo iscsiadm -m node -T "$IQN" -p "$INITIATOR_PORTAL_ADDR" --login >"$ARTIFACT_DIR/login-bad.${suffix}.log" 2>&1; then
echo "wrong CHAP secret unexpectedly logged in" >&2
exit 1
fi
sudo iscsiadm -m session >"$ARTIFACT_DIR/iscsi-sessions.bad-auth.${suffix}.txt" 2>&1 || true
sudo iscsiadm -m node -T "$IQN" -p "127.0.0.1:${PORT}" --op=update -n node.session.auth.password -v "$CHAP_SECRET" >>"$ARTIFACT_DIR/node-auth.${suffix}.log" 2>&1
sudo iscsiadm -m node -T "$IQN" -p "$INITIATOR_PORTAL_ADDR" --op=update -n node.session.auth.password -v "$CHAP_SECRET" >>"$ARTIFACT_DIR/node-auth.${suffix}.log" 2>&1
fi
else
sudo iscsiadm -m discovery -t sendtargets -p "127.0.0.1:${PORT}" | tee "$ARTIFACT_DIR/discovery.${suffix}.log"
sudo iscsiadm -m discovery -t sendtargets -p "$INITIATOR_PORTAL_ADDR" | tee "$ARTIFACT_DIR/discovery.${suffix}.log"
fi
sudo iscsiadm -m node -T "$IQN" -p "127.0.0.1:${PORT}" --login | tee "$ARTIFACT_DIR/login.${suffix}.log"
sudo iscsiadm -m node -T "$IQN" -p "$INITIATOR_PORTAL_ADDR" --login | tee "$ARTIFACT_DIR/login.${suffix}.log"
log "iteration ${iter}: wait kernel block device"
local dev=""
@@ -348,8 +380,8 @@ run_iteration() {
sudo umount "$MOUNT_DIR"
log "iteration ${iter}: logout"
sudo iscsiadm -m node -T "$IQN" -p "127.0.0.1:${PORT}" --logout | tee "$ARTIFACT_DIR/logout.${suffix}.log"
sudo iscsiadm -m node -T "$IQN" -p "127.0.0.1:${PORT}" -o delete >>"$ARTIFACT_DIR/logout.${suffix}.log" 2>&1 || true
sudo iscsiadm -m node -T "$IQN" -p "$INITIATOR_PORTAL_ADDR" --logout | tee "$ARTIFACT_DIR/logout.${suffix}.log"
sudo iscsiadm -m node -T "$IQN" -p "$INITIATOR_PORTAL_ADDR" -o delete >>"$ARTIFACT_DIR/logout.${suffix}.log" 2>&1 || true
sudo iscsiadm -m session >"$ARTIFACT_DIR/iscsi-sessions.${suffix}.txt" 2>&1 || true
if ! grep -q "No active sessions" "$ARTIFACT_DIR/iscsi-sessions.${suffix}.txt"; then
cat "$ARTIFACT_DIR/iscsi-sessions.${suffix}.txt"
+12
View File
@@ -0,0 +1,12 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT="${1:-$(pwd)}"
export SW_BLOCK_RUN_LABEL="${SW_BLOCK_RUN_LABEL:-blockvolume-restart}"
export SW_BLOCK_LAUNCHER_PVC_OWNER_REF="${SW_BLOCK_LAUNCHER_PVC_OWNER_REF:-1}"
export SW_BLOCK_LAUNCHER_STATE_HOSTPATH="${SW_BLOCK_LAUNCHER_STATE_HOSTPATH:-/var/lib/sw-block}"
export SW_BLOCK_RESTART_BLOCKVOLUME_BEFORE_READER=1
export SW_BLOCK_DEMO_APP_MANIFEST="${SW_BLOCK_DEMO_APP_MANIFEST:-$ROOT/deploy/k8s/alpha/demo-app-pvc-writer-hold-root.yaml}"
exec bash "$ROOT/scripts/run-alpha-app-demo.sh" "$ROOT"
+155 -6
View File
@@ -13,20 +13,127 @@ The intended boundary is:
- QA can run the same YAML locally or from CI; developers can run it before
pushing to avoid stale-image / stale-process / scattered-artifact loops.
## Runner Binary
`swblock` is the `sw-test-runner` binary used for Seaweed Block / V3 tests.
- Source repo: `pingqiu/sw-test-runner`
- Source path: `cmd/swblock/main.go`
- Build command from the runner repo:
```bash
go build -o swblock ./cmd/swblock
```
- Windows QA convention: `C:\work\swblock.exe`
- Linux controller convention: put `swblock` on `PATH`, or set a shell alias to
the built binary.
`swblock` is not built from this product repo. If a developer only has
`seaweed_block` checked out, runner-native scenarios can still be authored and
statically reviewed here, but `swblock validate`, `swblock run`, and
`swblock suite` require the external runner binary.
Convenience build helpers are available when the runner source is accessible:
```powershell
.\internal\tools\build-swblock.ps1
```
```bash
bash internal/tools/build-swblock.sh
```
They build into `.tools/swblock(.exe)`, write `.tools/swblock.path`, and print
the final binary path.
Related runner binaries share the same engine but link different product/action
sets:
- `swblock`: V3 / Seaweed Block product pack.
- `weedblock`: V2 product pack.
- `cmd/sw-test-runner`: kitchen-sink/dev binary.
Recommended local check before running scenarios:
```bash
swblock list
swblock validate testops/scenarios/csi-rf1-durable-restart-chain.yaml
```
## Which Gate To Run
Use the smallest gate that can prove the contract you changed.
| Change type | Default gate | Why |
| --- | --- | --- |
| Package-local logic, parser, renderer, state-machine helper | `go test -count=1 ./<touched-package>` | Fastest feedback; no m02 or runner dependency. |
| CSI protocol propagation, lifecycle persistence, launcher render shape | `swblock run testops/scenarios/nvme-p5-protocol-component-gate.yaml` | Proves the known NVMe/iSCSI protocol-shape contracts with a runner bundle in seconds. |
| RF=1 restart contract, durable-root/status manifest shape | `swblock run testops/scenarios/csi-rf1-durable-restart-component-gate.yaml` | Proves restart/recovery contract shape without a full K8s restart. |
| Operations read-only volume status report shape | `swblock run testops/scenarios/operations-volume-status-report-component-gate.yaml` | Proves schema, frontend identity, unavailable fields, and residue copy behavior without starting product processes. |
| Kernel initiator, k3s, mounted filesystem, failover, or stale-session behavior | The matching child chain, for example `nvme-p5-csi-protocol-chain` or `csi-rf1-durable-restart-chain` | These require real Linux/K8s/initiator behavior. |
| Milestone readiness or cross-protocol release confidence | `swblock suite testops/suites/beta-hardening-gate.yaml` plus `swblock validate-bundle --profile beta-hardening` | Slow, evidence-heavy gate. Use for release/milestone claims, not first debugging. |
Default ownership:
- Developers run unit/component tests, fast runner-native component gates, and
single-child chains while iterating.
- QA runs full-suite repeatability, long soak, ambiguous lab failures, and
independent milestone validation.
- If QA would only execute a single known command and return stdout, run it
yourself and reserve QA for scenario design or trust-critical validation.
Example:
```bash
swblock run testops/scenarios/nvme-p5-csi-protocol-chain.yaml \
--env product_root=/path/to/seaweed_block/on/m02 \
--env ssh_key=/path/to/testdev_key/on/controller
swblock run \
-env product_root=/path/to/seaweed_block/on/m02 \
-env ssh_key=/path/to/testdev_key/on/controller \
testops/scenarios/nvme-p5-csi-protocol-chain.yaml
```
Fast component gates are available for developer loops before running the
heavier K8s or initiator paths. For example, the NVMe-P5 protocol component
gate pins CSI protocol extraction, lifecycle protocol planning, and launcher
protocol persistence/planning, plus launcher NVMe/iSCSI manifest shape without
launching k3s:
```bash
swblock run \
-env product_root=/path/to/seaweed_block/on/m02 \
-env ssh_key=/path/to/testdev_key/on/controller \
testops/scenarios/nvme-p5-protocol-component-gate.yaml
```
The RF=1 durable restart path also has a component gate that checks restart
wrapper shape, generated hostPath/status manifest behavior, master frontend
projection, and durable status lineage without doing the full K8s restart:
```bash
swblock run \
-env product_root=/path/to/seaweed_block/on/m02 \
-env ssh_key=/path/to/testdev_key/on/controller \
testops/scenarios/csi-rf1-durable-restart-component-gate.yaml
```
The first operations-layer status report contract has its own component gate.
It is read-only, does not start product processes, and is not a block/data
snapshot:
```bash
swblock run \
-env product_root=/path/to/seaweed_block/on/m02 \
-env ssh_key=/path/to/testdev_key/on/controller \
testops/scenarios/operations-volume-status-report-component-gate.yaml
```
The same runner-native shape is used for the longer iSCSI P8 soak:
```bash
swblock run testops/scenarios/iscsi-p8-compat-soak-chain.yaml \
--env product_root=/path/to/seaweed_block/on/m02 \
--env ssh_key=/path/to/testdev_key/on/controller
swblock run \
-env product_root=/path/to/seaweed_block/on/m02 \
-env ssh_key=/path/to/testdev_key/on/controller \
testops/scenarios/iscsi-p8-compat-soak-chain.yaml
```
The scenario still shells out to existing bash payloads. That is deliberate:
@@ -135,3 +242,45 @@ python3 scripts/testops-validate-protocol-release-gate.py \
Use `--allow-fail` when validating the schema of an intentionally failed or
cancelled run; without it the checker requires all four child chains to be
`pass` with complete phase counts.
## Beta Hardening Gate
`testops/suites/beta-hardening-gate.yaml` is the seed suite for the current
beta-hardening plan. It composes the protocol release children plus the new
component/restart/reintegration gates:
- `iscsi-p6-alua-failover-chain`
- `nvme-p4-multipath-failover-chain`
- `nvme-p5-csi-protocol-chain`
- `iscsi-p8-compat-soak-chain`
- `csi-lifecycle-component-gate`
- `csi-rf1-durable-restart-chain`
- `operations-status-diagnostics-chain`
- `returned-replica-component-gate`
- `iscsi-returned-replica-chain`
- `cleanup-residue-chain`
Run shape:
```powershell
swblock suite `
--results-dir V:/share/g15d-k8s/testops-runs/beta-hardening-gate `
--env product_root=/tmp/seaweed-block-plan-roadmap-refresh-devrun `
--env ssh_key=C:/work/dev_server/testdev_key `
C:/work/seaweed_block/testops/suites/beta-hardening-gate.yaml
```
Repeatability evidence:
- product commit:
`8822f20e91c2b88727ead9e49f9bf75eec28c791`
- runner commit:
`cf65daaf2ce5cf500e1efa48b411f7cb66dbac0b`
- run 1: `20260511-031605-8258`, PASS, `21m46s`,
`validate-bundle --profile beta-hardening` VALID.
- run 2: `20260511-040412-ac38`, PASS, `22m55s`,
`validate-bundle --profile beta-hardening` VALID.
- no manual cleanup between runs; final residue audit clean.
Use this suite for milestone readiness or release-candidate confidence. Do not
use it as the first debug loop for a package-level change.
@@ -0,0 +1,84 @@
# Runner-native cleanup residue audit.
#
# Goal:
# Prove the lab is clean before the next workload starts. This is not an
# install/uninstall functional test; it is a repeatability guard for beta
# suites that should fail when stale iSCSI/NVMe/K8s/process state leaks from
# earlier children.
#
# Expected invocation:
# swblock run \
# -env product_root=/path/to/seaweed_block/on/m02 \
# -env ssh_key=/path/to/testdev_key/on/controller \
# testops/scenarios/cleanup-residue-chain.yaml
name: cleanup-residue-chain
timeout: 6m
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: host_protocol_residue
actions:
- action: exec
node: m02
cmd: "rm -rf /mnt/smb/work/share/g15d-k8s/{{ run_id }}-cleanup-residue && mkdir -p /mnt/smb/work/share/g15d-k8s/{{ run_id }}-cleanup-residue/uninstall /mnt/smb/work/share/g15d-k8s/{{ run_id }}-cleanup-residue/pin_build"
- action: exec
node: m02
cmd: "cd {{ product_root }} && git rev-parse HEAD > /mnt/smb/work/share/g15d-k8s/{{ run_id }}-cleanup-residue/pin_build/git.sha && git status --porcelain > /mnt/smb/work/share/g15d-k8s/{{ run_id }}-cleanup-residue/pin_build/git.status && test ! -s /mnt/smb/work/share/g15d-k8s/{{ run_id }}-cleanup-residue/pin_build/git.status"
- action: exec
node: m02
cmd: "command -v iscsiadm >/dev/null && (sudo -n iscsiadm -m session > /mnt/smb/work/share/g15d-k8s/{{ run_id }}-cleanup-residue/iscsi-sessions.after-cleanup.txt 2>&1 || grep -q 'No active sessions' /mnt/smb/work/share/g15d-k8s/{{ run_id }}-cleanup-residue/iscsi-sessions.after-cleanup.txt)"
- action: assert_no_active_iscsi_sessions
node: m02
iqn_substr: "io.seaweedfs"
- action: exec
node: m02
cmd: "sudo nvme list-subsys -o json > /mnt/smb/work/share/g15d-k8s/{{ run_id }}-cleanup-residue/nvme-list-subsys.after-cleanup.json 2> /mnt/smb/work/share/g15d-k8s/{{ run_id }}-cleanup-residue/nvme-list-subsys.after-cleanup.err && ! grep -Ei 'nqn\\.[^[:space:]\"}]*seaweedfs|nqn\\.[^[:space:]\"}]*sw-block|nqn\\.[^[:space:]\"}]*weedblock' /mnt/smb/work/share/g15d-k8s/{{ run_id }}-cleanup-residue/nvme-list-subsys.after-cleanup.json"
- action: assert_no_processes
node: m02
pattern: "[/]blockmaster --|[/]blockvolume --|[/]blockcsi |[/]iscsi-target |^blockmaster |^blockvolume |^blockcsi |^iscsi-target "
- name: kubernetes_residue
actions:
- action: exec
node: m02
cmd: "bash -e -c 'kubectl get deploy,daemonset,statefulset,pod,svc,pvc,pv -A -o name > /mnt/smb/work/share/g15d-k8s/{{ run_id }}-cleanup-residue/k8s-resources.after-cleanup.txt 2> /mnt/smb/work/share/g15d-k8s/{{ run_id }}-cleanup-residue/k8s-resources.after-cleanup.err; kubectl get storageclass,csidriver -o name >> /mnt/smb/work/share/g15d-k8s/{{ run_id }}-cleanup-residue/k8s-resources.after-cleanup.txt 2>> /mnt/smb/work/share/g15d-k8s/{{ run_id }}-cleanup-residue/k8s-resources.after-cleanup.err; if grep -E \"(sw-block|seaweed-block|block\\.csi\\.seaweedfs\\.com)\" /mnt/smb/work/share/g15d-k8s/{{ run_id }}-cleanup-residue/k8s-resources.after-cleanup.txt > /mnt/smb/work/share/g15d-k8s/{{ run_id }}-cleanup-residue/k8s-residue.after-cleanup.txt; then exit 1; fi'"
- name: hostpath_residue
actions:
- action: exec
node: m02
cmd: "if sudo test -d /var/lib/sw-block; then sudo find /var/lib/sw-block -maxdepth 1 -mindepth 1 -print > /mnt/smb/work/share/g15d-k8s/{{ run_id }}-cleanup-residue/sw-block-hostpath.all.txt; sudo find /var/lib/sw-block -maxdepth 1 -mindepth 1 -type d -name 'testops-*' -print > /mnt/smb/work/share/g15d-k8s/{{ run_id }}-cleanup-residue/sw-block-hostpath-testops-residue.txt; else : > /mnt/smb/work/share/g15d-k8s/{{ run_id }}-cleanup-residue/sw-block-hostpath.all.txt; : > /mnt/smb/work/share/g15d-k8s/{{ run_id }}-cleanup-residue/sw-block-hostpath-testops-residue.txt; fi; test ! -s /mnt/smb/work/share/g15d-k8s/{{ run_id }}-cleanup-residue/sw-block-hostpath-testops-residue.txt"
- name: collect_and_cleanup
always: true
actions:
- action: exec
node: m02
timeout: 3m
cmd: "cd {{ product_root }} && bash scripts/uninstall-k8s-alpha.sh {{ product_root }}"
env.SW_BLOCK_ARTIFACT_DIR: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-cleanup-residue/uninstall"
- action: exec
node: m02
cmd: "kubectl delete storageclass sw-block sw-block-example sw-block-dynamic sw-block-dynamic-nvme --ignore-not-found=true > /mnt/smb/work/share/g15d-k8s/{{ run_id }}-cleanup-residue/delete-storageclasses.log 2>&1 || true"
- action: pre_run_cleanup
node: m02
kill_patterns: "blockmaster,blockvolume,blockcsi,iscsi-target"
unmount: "/tmp/sw-block-iscsi-os/mnt,/tmp/sw-block-iscsi-failover/mnt,/tmp/sw-block-iscsi-mpath/mnt,/tmp/sw-block-nvme-failover/mnt"
nvme_disconnect: "true"
iscsi_logout_prefix: "iqn.2026-05.io.seaweedfs"
- action: collect_path
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-cleanup-residue"
name: "remote-phases"
ignore_error: true
@@ -0,0 +1,94 @@
# Runner-native CSI lifecycle component gate.
#
# Goal:
# Run the fast CSI controller/node component tests that pin publish,
# stage, unpublish, unstage, and reattach semantics without requiring a
# privileged Linux initiator or Kubernetes workload.
#
# Expected invocation:
# swblock run \
# -env product_root=/path/to/seaweed_block/on/m02 \
# -env ssh_key=/path/to/testdev_key/on/controller \
# testops/scenarios/csi-lifecycle-component-gate.yaml
name: csi-lifecycle-component-gate
timeout: 5m
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: pre_clean
actions:
- action: assert_no_active_iscsi_sessions
node: m02
iqn_substr: "io.seaweedfs"
- action: assert_no_processes
node: m02
pattern: "[/]blockmaster --|[/]blockvolume --|^blockmaster |^blockvolume "
- action: exec
node: m02
cmd: "rm -rf /mnt/smb/work/share/g15d-k8s/{{ run_id }}-csi-lifecycle-component && mkdir -p /mnt/smb/work/share/g15d-k8s/{{ run_id }}-csi-lifecycle-component/pin_build"
- name: pin_build
actions:
- action: exec
node: m02
cmd: "cd {{ product_root }} && git rev-parse HEAD > /mnt/smb/work/share/g15d-k8s/{{ run_id }}-csi-lifecycle-component/pin_build/git.sha && git status --porcelain > /mnt/smb/work/share/g15d-k8s/{{ run_id }}-csi-lifecycle-component/pin_build/git.status && test ! -s /mnt/smb/work/share/g15d-k8s/{{ run_id }}-csi-lifecycle-component/pin_build/git.status"
- name: csi_component_tests
actions:
- action: exec
node: m02
timeout: 3m
cmd: "cd {{ product_root }} && bash -o pipefail -c 'go test -count=1 -v ./core/csi | tee /mnt/smb/work/share/g15d-k8s/{{ run_id }}-csi-lifecycle-component/core-csi-go-test.log'"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-csi-lifecycle-component/core-csi-go-test.log"
pattern: "--- PASS: TestG15e_CSIReattachUsesFreshPublishTargetAfterUnstage"
save_as: reattach_component_count
- action: assert_greater
actual: "{{ reattach_component_count }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-csi-lifecycle-component/core-csi-go-test.log"
pattern: "--- PASS: TestNodeStage_FailsClosedOnStaleLoggedInSessionWithoutStagedIdentity"
save_as: stale_session_component_count
- action: assert_greater
actual: "{{ stale_session_component_count }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-csi-lifecycle-component/core-csi-go-test.log"
pattern: "--- PASS: TestNodeStageUnstage_RepeatedCyclesLeaveNoLocalState"
save_as: repeated_cycle_component_count
- action: assert_greater
actual: "{{ repeated_cycle_component_count }}"
threshold: "0"
- name: final_asserts
actions:
- action: assert_no_active_iscsi_sessions
node: m02
iqn_substr: "io.seaweedfs"
- action: assert_no_processes
node: m02
pattern: "[/]blockmaster --|[/]blockvolume --|^blockmaster |^blockvolume "
- name: collect_and_cleanup
always: true
actions:
- action: collect_path
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-csi-lifecycle-component"
name: "remote-phases"
ignore_error: true
@@ -0,0 +1,242 @@
# Runner-native RF=1 durable blockvolume restart chain.
#
# Goal:
# clean target -> build/import alpha images -> run dynamic PVC with durable
# generated blockvolume hostPath state -> restart generated blockvolume
# Deployment -> verify replacement app pod reads pre-restart bytes -> collect.
#
# Expected invocation from sw-test-runner-standalone:
# swblock run \
# -env product_root=/path/to/seaweed_block/on/m02 \
# -env ssh_key=/path/to/testdev_key/on/controller \
# testops/scenarios/csi-rf1-durable-restart-chain.yaml
name: csi-rf1-durable-restart-chain
timeout: 18m
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: pre_clean
actions:
- action: pre_run_cleanup
node: m02
kill_patterns: "blockmaster,blockvolume,iscsi-target"
nvme_disconnect: "true"
iscsi_logout_prefix: "iqn.2026-05.io.seaweedfs"
- action: exec
node: m02
cmd: "rm -rf /mnt/smb/work/share/g15d-k8s/{{ run_id }}-csi-rf1-restart-chain && mkdir -p /mnt/smb/work/share/g15d-k8s/{{ run_id }}-csi-rf1-restart-chain"
- action: assert_no_active_iscsi_sessions
node: m02
iqn_substr: "io.seaweedfs"
- action: assert_no_processes
node: m02
pattern: "[/]blockmaster --|[/]blockvolume --|^blockmaster |^blockvolume "
- name: pin_build_alpha_images
actions:
- action: exec
node: m02
timeout: 8m
cmd: "cd {{ product_root }} && bash scripts/build-alpha-images.sh {{ product_root }}"
env.SW_BLOCK_IMPORT_K3S: "1"
env.SW_BLOCK_ARTIFACT_DIR: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-csi-rf1-restart-chain/pin_build"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-csi-rf1-restart-chain/pin_build/alpha-images.env"
pattern: "SW_BLOCK_IMAGE_ID="
save_as: pin_image_id_count
- action: assert_greater
actual: "{{ pin_image_id_count }}"
threshold: "0"
- name: durable_blockvolume_restart
actions:
- action: exec
node: m02
timeout: 10m
cmd: "cd {{ product_root }} && bash scripts/run-k8s-blockvolume-restart.sh {{ product_root }}"
env.SW_BLOCK_ALPHA_IMAGES_ENV: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-csi-rf1-restart-chain/pin_build/alpha-images.env"
env.SW_BLOCK_ARTIFACT_DIR: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-csi-rf1-restart-chain/durable_blockvolume_restart"
env.SW_BLOCK_LAUNCHER_STATE_HOSTPATH: "/var/lib/sw-block/testops-{{ run_id }}-csi-rf1-restart"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-csi-rf1-restart-chain/durable_blockvolume_restart/run.log"
pattern: "\\[app-demo\\] PASS:"
save_as: app_pass_count
- action: assert_greater
actual: "{{ app_pass_count }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-csi-rf1-restart-chain/durable_blockvolume_restart/run.log"
pattern: "restart_blockvolume_before_reader=1"
save_as: restart_mode_count
- action: assert_greater
actual: "{{ restart_mode_count }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-csi-rf1-restart-chain/durable_blockvolume_restart/block-stack.rendered.yaml"
pattern: "--launcher-status"
save_as: launcher_status_count
- action: assert_greater
actual: "{{ launcher_status_count }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-csi-rf1-restart-chain/durable_blockvolume_restart/block-stack.rendered.yaml"
pattern: "--launcher-state-hostpath=/var/lib/sw-block/testops-{{ run_id }}-csi-rf1-restart"
save_as: launcher_state_hostpath_count
- action: assert_greater
actual: "{{ launcher_state_hostpath_count }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-csi-rf1-restart-chain/durable_blockvolume_restart/generated-blockvolume.yaml"
pattern: "hostPath:"
save_as: generated_hostpath_count
- action: assert_greater
actual: "{{ generated_hostpath_count }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-csi-rf1-restart-chain/durable_blockvolume_restart/generated-blockvolume.yaml"
pattern: "type: DirectoryOrCreate"
save_as: generated_hostpath_type_count
- action: assert_greater
actual: "{{ generated_hostpath_type_count }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-csi-rf1-restart-chain/durable_blockvolume_restart/generated-blockvolume.yaml"
pattern: "--status-addr=127.0.0.1:"
save_as: generated_status_addr_count
- action: assert_greater
actual: "{{ generated_status_addr_count }}"
threshold: "0"
- action: exec
node: m02
cmd: "awk 'BEGIN{in_volumes=0;in_state=0;bad=0} /^[[:space:]]*volumes:[[:space:]]*$/{in_volumes=1;next} in_volumes && /^[^[:space:]]/{in_volumes=0;in_state=0} in_volumes && /^[[:space:]]*-[[:space:]]*name:[[:space:]]*state[[:space:]]*$/{in_state=1;next} in_state && /^[[:space:]]*-[[:space:]]*name:[[:space:]]*/{in_state=0} in_state && /emptyDir:/{bad=1} END{exit bad}' /mnt/smb/work/share/g15d-k8s/{{ run_id }}-csi-rf1-restart-chain/durable_blockvolume_restart/generated-blockvolume.yaml"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-csi-rf1-restart-chain/durable_blockvolume_restart/writer.log"
pattern: "\\[app-writer\\] wrote and verified /data/demo.bin"
save_as: writer_checksum_count
- action: assert_greater
actual: "{{ writer_checksum_count }}"
threshold: "0"
- action: exec
node: m02
cmd: "test -s /mnt/smb/work/share/g15d-k8s/{{ run_id }}-csi-rf1-restart-chain/durable_blockvolume_restart/blockvolume-pod-ids.before-restart.tsv && test -s /mnt/smb/work/share/g15d-k8s/{{ run_id }}-csi-rf1-restart-chain/durable_blockvolume_restart/blockvolume-pod-ids.after-restart.tsv && ! cmp -s /mnt/smb/work/share/g15d-k8s/{{ run_id }}-csi-rf1-restart-chain/durable_blockvolume_restart/blockvolume-pod-ids.before-restart.tsv /mnt/smb/work/share/g15d-k8s/{{ run_id }}-csi-rf1-restart-chain/durable_blockvolume_restart/blockvolume-pod-ids.after-restart.tsv"
- action: exec
node: m02
cmd: "! grep -q 'iqn.2026-05.io.seaweedfs' /mnt/smb/work/share/g15d-k8s/{{ run_id }}-csi-rf1-restart-chain/durable_blockvolume_restart/iscsi-sessions.before-blockvolume-restart.txt"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-csi-rf1-restart-chain/durable_blockvolume_restart/restart-blockvolume-status.log"
pattern: "successfully rolled out"
save_as: blockvolume_rollout_count
- action: assert_greater
actual: "{{ blockvolume_rollout_count }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-csi-rf1-restart-chain/durable_blockvolume_restart/reader.log"
pattern: "/data/demo.bin: OK"
save_as: reader_checksum_count
- action: assert_greater
actual: "{{ reader_checksum_count }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-csi-rf1-restart-chain/durable_blockvolume_restart/reader.describe.before-delete.txt"
pattern: "Status: Succeeded"
save_as: reader_succeeded_describe_count
- action: assert_greater
actual: "{{ reader_succeeded_describe_count }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-csi-rf1-restart-chain/durable_blockvolume_restart/status-durable-after-blockvolume-restart.json"
pattern: "\"ReplicaID\"[[:space:]]*:[[:space:]]*\"r1\""
save_as: durable_status_replica_count
- action: assert_greater
actual: "{{ durable_status_replica_count }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-csi-rf1-restart-chain/durable_blockvolume_restart/status-durable-after-blockvolume-restart.json"
pattern: "\"Epoch\"[[:space:]]*:[[:space:]]*[1-9][0-9]*"
save_as: durable_status_epoch_count
- action: assert_greater
actual: "{{ durable_status_epoch_count }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-csi-rf1-restart-chain/durable_blockvolume_restart/status-durable-after-blockvolume-restart.json"
pattern: "\"Latched\"[[:space:]]*:[[:space:]]*true"
save_as: durable_status_latched_count
- action: assert_greater
actual: "{{ durable_status_latched_count }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-csi-rf1-restart-chain/durable_blockvolume_restart/status-durable-after-blockvolume-restart.json"
pattern: "\"Operational\"[[:space:]]*:[[:space:]]*true"
save_as: durable_status_operational_count
- action: assert_greater
actual: "{{ durable_status_operational_count }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-csi-rf1-restart-chain/durable_blockvolume_restart/blockvolume-generated.after-restart.log"
pattern: "\"phase\":\"iscsi-listening\""
save_as: blockvolume_iscsi_listening_count
- action: assert_greater
actual: "{{ blockvolume_iscsi_listening_count }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-csi-rf1-restart-chain/durable_blockvolume_restart/lifecycle-volumes.after-blockvolume-restart.json"
pattern: "\"protocol\"[[:space:]]*:[[:space:]]*\"iscsi\""
save_as: lifecycle_after_restart_protocol_count
- action: assert_greater
actual: "{{ lifecycle_after_restart_protocol_count }}"
threshold: "0"
- name: final_asserts
actions:
- action: assert_no_active_iscsi_sessions
node: m02
iqn_substr: "io.seaweedfs"
- action: assert_no_processes
node: m02
pattern: "[/]blockmaster --|[/]blockvolume --|^blockmaster |^blockvolume "
- action: exec
node: m02
cmd: "test ! -e /var/lib/sw-block/testops-{{ run_id }}-csi-rf1-restart"
- name: collect_and_cleanup
always: true
actions:
- action: pre_run_cleanup
node: m02
kill_patterns: "blockmaster,blockvolume,iscsi-target"
nvme_disconnect: "true"
iscsi_logout_prefix: "iqn.2026-05.io.seaweedfs"
- action: collect_path
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-csi-rf1-restart-chain"
name: "remote-phases"
ignore_error: true
@@ -0,0 +1,112 @@
# Runner-native RF=1 durable restart component gate.
#
# Goal:
# Pin the cheap contracts behind csi-rf1-durable-restart-chain without
# launching k3s: restart wrapper shape, generated hostPath/status manifests,
# master frontend status projection, and durable status endpoint lineage.
# The full csi-rf1-durable-restart-chain remains the end-to-end proof for
# pod restart, reattach timing, and mounted data continuity.
#
# Expected invocation:
# swblock run \
# -env product_root=/path/to/seaweed_block/on/m02 \
# -env ssh_key=/path/to/testdev_key/on/controller \
# testops/scenarios/csi-rf1-durable-restart-component-gate.yaml
name: csi-rf1-durable-restart-component-gate
timeout: 5m
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: pre_clean
actions:
- action: assert_no_active_iscsi_sessions
node: m02
iqn_substr: "io.seaweedfs"
- action: assert_no_processes
node: m02
pattern: "[/]blockmaster --|[/]blockvolume --|^blockmaster |^blockvolume "
- action: exec
node: m02
cmd: "rm -rf /mnt/smb/work/share/g15d-k8s/{{ run_id }}-csi-rf1-restart-component && mkdir -p /mnt/smb/work/share/g15d-k8s/{{ run_id }}-csi-rf1-restart-component/pin_build"
- name: pin_build
actions:
- action: exec
node: m02
cmd: "cd {{ product_root }} && git rev-parse HEAD > /mnt/smb/work/share/g15d-k8s/{{ run_id }}-csi-rf1-restart-component/pin_build/git.sha && git status --porcelain > /mnt/smb/work/share/g15d-k8s/{{ run_id }}-csi-rf1-restart-component/pin_build/git.status && test ! -s /mnt/smb/work/share/g15d-k8s/{{ run_id }}-csi-rf1-restart-component/pin_build/git.status"
- name: restart_component_tests
actions:
- action: exec
node: m02
timeout: 3m
cmd: "cd {{ product_root }} && bash -o pipefail -c 'go test -count=1 -json -run \"^(TestCSIRF1DurableRestartScripts_PinBlockvolumeRestartContract|TestG15d_K8sRenderer_CanUseHostPathStateVolume|TestG15d_K8sRenderer_CanOptIntoBlockVolumeStatusEndpoint|TestStatusFrontendsForAssignedLine_ReturnsObservedFrontendFacts|TestStatusServer_DurableStatusEndpoint_EnabledAfterStart_ReturnsLineage)$\" ./internal/testops ./core/host/master ./core/host/volume ./core/launcher | tee /mnt/smb/work/share/g15d-k8s/{{ run_id }}-csi-rf1-restart-component/restart-component-go-test.jsonl'"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-csi-rf1-restart-component/restart-component-go-test.jsonl"
pattern: "\"Action\":\"pass\".*\"Test\":\"TestCSIRF1DurableRestartScripts_PinBlockvolumeRestartContract\""
save_as: restart_wrapper_shape_count
- action: assert_greater
actual: "{{ restart_wrapper_shape_count }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-csi-rf1-restart-component/restart-component-go-test.jsonl"
pattern: "\"Action\":\"pass\".*\"Test\":\"TestG15d_K8sRenderer_CanUseHostPathStateVolume\""
save_as: hostpath_render_count
- action: assert_greater
actual: "{{ hostpath_render_count }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-csi-rf1-restart-component/restart-component-go-test.jsonl"
pattern: "\"Action\":\"pass\".*\"Test\":\"TestG15d_K8sRenderer_CanOptIntoBlockVolumeStatusEndpoint\""
save_as: status_render_count
- action: assert_greater
actual: "{{ status_render_count }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-csi-rf1-restart-component/restart-component-go-test.jsonl"
pattern: "\"Action\":\"pass\".*\"Test\":\"TestStatusFrontendsForAssignedLine_ReturnsObservedFrontendFacts\""
save_as: master_frontend_projection_count
- action: assert_greater
actual: "{{ master_frontend_projection_count }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-csi-rf1-restart-component/restart-component-go-test.jsonl"
pattern: "\"Action\":\"pass\".*\"Test\":\"TestStatusServer_DurableStatusEndpoint_EnabledAfterStart_ReturnsLineage\""
save_as: durable_status_lineage_count
- action: assert_greater
actual: "{{ durable_status_lineage_count }}"
threshold: "0"
- name: final_asserts
actions:
- action: assert_no_active_iscsi_sessions
node: m02
iqn_substr: "io.seaweedfs"
- action: assert_no_processes
node: m02
pattern: "[/]blockmaster --|[/]blockvolume --|^blockmaster |^blockvolume "
- name: collect_and_cleanup
always: true
actions:
- action: collect_path
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-csi-rf1-restart-component"
name: "remote-phases"
ignore_error: true
@@ -0,0 +1,137 @@
# Runner-native iSCSI OS-initiator compatibility gate.
#
# Goal:
# Prove the Linux open-iscsi path against a real kernel initiator:
# iscsiadm discovery/login -> mkfs.ext4 -> mount -> write/read checksum
# -> optional fio stress -> logout -> no residue.
#
# This is an iSCSI correctness gate. It is not a performance, HA, multipath,
# Windows, or Kubernetes claim.
#
# Expected invocation:
# swblock run \
# -env product_root=/path/to/seaweed_block/on/m02 \
# -env ssh_key=/path/to/testdev_key/on/controller \
# testops/scenarios/iscsi-os-initiator-compat-chain.yaml
name: iscsi-os-initiator-compat-chain
timeout: 20m
env:
product_root: "/tmp/seaweed_block"
ssh_key: "C:\\work\\dev_server\\testdev_key"
os_iterations: "1"
os_stress: "fio"
os_fio_runtime: "60"
os_fio_size: "128m"
durable_blocks: "65536"
topology:
nodes:
m02:
host: 192.168.1.184
user: testdev
key: "{{ ssh_key }}"
phases:
- name: pre_clean
actions:
- action: pre_run_cleanup
node: m02
kill_patterns: "blockmaster,blockvolume,iscsi-target"
nvme_disconnect: "true"
iscsi_logout_prefix: "iqn.2026-05.io.seaweedfs"
- action: exec
node: m02
cmd: "rm -rf /mnt/smb/work/share/g15d-k8s/{{ run_id }}-iscsi-os-compat && mkdir -p /mnt/smb/work/share/g15d-k8s/{{ run_id }}-iscsi-os-compat/bin /mnt/smb/work/share/g15d-k8s/{{ run_id }}-iscsi-os-compat/pin_build /mnt/smb/work/share/g15d-k8s/{{ run_id }}-iscsi-os-compat/os_smoke"
- action: assert_no_active_iscsi_sessions
node: m02
iqn_substr: "io.seaweedfs"
- action: assert_no_processes
node: m02
pattern: "[/]blockmaster --|[/]blockvolume --|^blockmaster |^blockvolume "
- name: pin_build
actions:
- action: exec
node: m02
timeout: 8m
cmd: "cd {{ product_root }} && git rev-parse HEAD > /mnt/smb/work/share/g15d-k8s/{{ run_id }}-iscsi-os-compat/pin_build/git.sha && git status --porcelain > /mnt/smb/work/share/g15d-k8s/{{ run_id }}-iscsi-os-compat/pin_build/git.status && test ! -s /mnt/smb/work/share/g15d-k8s/{{ run_id }}-iscsi-os-compat/pin_build/git.status && go build -o /mnt/smb/work/share/g15d-k8s/{{ run_id }}-iscsi-os-compat/bin/blockmaster ./cmd/blockmaster && go build -o /mnt/smb/work/share/g15d-k8s/{{ run_id }}-iscsi-os-compat/bin/blockvolume ./cmd/blockvolume"
- action: exec
node: m02
cmd: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-iscsi-os-compat/bin/blockmaster --version > /mnt/smb/work/share/g15d-k8s/{{ run_id }}-iscsi-os-compat/pin_build/blockmaster.version.txt && /mnt/smb/work/share/g15d-k8s/{{ run_id }}-iscsi-os-compat/bin/blockvolume --version > /mnt/smb/work/share/g15d-k8s/{{ run_id }}-iscsi-os-compat/pin_build/blockvolume.version.txt"
- name: os_initiator_smoke
actions:
- action: exec
node: m02
cmd: "sudo dmesg > /mnt/smb/work/share/g15d-k8s/{{ run_id }}-iscsi-os-compat/os_smoke/dmesg.before.txt 2>&1 || true"
- action: exec
node: m02
timeout: 12m
cmd: "cd {{ product_root }} && bash scripts/run-iscsi-os-smoke.sh {{ product_root }}"
env.SW_BLOCK_ARTIFACT_DIR: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-iscsi-os-compat/os_smoke"
env.SW_BLOCK_BIN_DIR: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-iscsi-os-compat/bin"
env.SW_BLOCK_ISCSI_ITERATIONS: "{{ os_iterations }}"
env.SW_BLOCK_ISCSI_STRESS: "{{ os_stress }}"
env.SW_BLOCK_ISCSI_FIO_RUNTIME: "{{ os_fio_runtime }}"
env.SW_BLOCK_ISCSI_FIO_SIZE: "{{ os_fio_size }}"
env.SW_BLOCK_DURABLE_BLOCKS: "{{ durable_blocks }}"
- action: exec
node: m02
cmd: "sudo dmesg > /mnt/smb/work/share/g15d-k8s/{{ run_id }}-iscsi-os-compat/os_smoke/dmesg.after.txt 2>&1 || true"
- action: exec
node: m02
cmd: "python3 - <<'PY'\nimport re, sys\nbase = '/mnt/smb/work/share/g15d-k8s/{{ run_id }}-iscsi-os-compat/os_smoke'\nts_re = re.compile(r'^\\[\\s*([0-9]+(?:\\.[0-9]+)?)\\]')\ndef read_lines(name):\n with open(base + '/' + name, encoding='utf-8', errors='replace') as f:\n return f.read().splitlines()\ndef ts(line):\n m = ts_re.match(line)\n return float(m.group(1)) if m else None\nbefore = read_lines('dmesg.before.txt')\nafter = read_lines('dmesg.after.txt')\nbefore_ts = [v for v in (ts(line) for line in before) if v is not None]\nif before_ts:\n cutoff = max(before_ts)\n new = [line for line in after if (ts(line) is not None and ts(line) > cutoff)]\nelse:\n i = 0\n while i < len(before) and i < len(after) and before[i] == after[i]:\n i += 1\n new = after[i:]\nwith open(base + '/dmesg.new.txt', 'w', encoding='utf-8') as f:\n f.write('\\n'.join(new))\n if new:\n f.write('\\n')\nbad = re.compile(r'DID_BAD_TARGET|I/O error|Buffer I/O|rejecting I/O|blk_update_request|connection.*failed', re.I)\nhits = [line for line in new if bad.search(line)]\nif hits:\n print('\\n'.join(hits), file=sys.stderr)\n sys.exit(1)\nPY"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-iscsi-os-compat/os_smoke/run.log"
pattern: "\\[iscsi-os\\] PASS:"
save_as: os_pass_count
- action: assert_greater
actual: "{{ os_pass_count }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-iscsi-os-compat/os_smoke/mkfs.iter1.log"
pattern: "Writing superblocks and filesystem accounting information"
save_as: mkfs_success_count
- action: assert_greater
actual: "{{ mkfs_success_count }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-iscsi-os-compat/os_smoke/sha256-check.iter1.log"
pattern: "payload.iter1.bin: OK"
save_as: checksum_success_count
- action: assert_greater
actual: "{{ checksum_success_count }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-iscsi-os-compat/os_smoke/fio.iter1.log"
pattern: "err= 0"
save_as: fio_success_count
- action: assert_greater
actual: "{{ fio_success_count }}"
threshold: "0"
- action: assert_no_active_iscsi_sessions
node: m02
iqn_substr: "io.seaweedfs"
- action: assert_no_processes
node: m02
pattern: "[/]blockmaster --|[/]blockvolume --|^blockmaster |^blockvolume "
- name: collect_and_cleanup
always: true
actions:
- action: pre_run_cleanup
node: m02
kill_patterns: "blockmaster,blockvolume,iscsi-target"
nvme_disconnect: "true"
iscsi_logout_prefix: "iqn.2026-05.io.seaweedfs"
- action: collect_path
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-iscsi-os-compat"
name: "remote-phases"
ignore_error: true
@@ -6,9 +6,10 @@
# -> mounted failover -> final cleanup/asserts -> shared artifact collection.
#
# Expected invocation from sw-test-runner-standalone:
# swblock run testops/scenarios/iscsi-p6-alua-failover-chain.yaml \
# --env product_root=/path/to/seaweed_block/on/m02 \
# --env ssh_key=/path/to/testdev_key/on/controller
# swblock run \
# -env product_root=/path/to/seaweed_block/on/m02 \
# -env ssh_key=/path/to/testdev_key/on/controller \
# testops/scenarios/iscsi-p6-alua-failover-chain.yaml
name: iscsi-p6-alua-failover-chain
timeout: 25m
@@ -5,9 +5,10 @@
# collection.
#
# Expected invocation from sw-test-runner-standalone:
# swblock run testops/scenarios/iscsi-p8-compat-soak-chain.yaml \
# --env product_root=/path/to/seaweed_block/on/m02 \
# --env ssh_key=/path/to/testdev_key/on/controller
# swblock run \
# -env product_root=/path/to/seaweed_block/on/m02 \
# -env ssh_key=/path/to/testdev_key/on/controller \
# testops/scenarios/iscsi-p8-compat-soak-chain.yaml
name: iscsi-p8-compat-soak-chain
timeout: 35m
@@ -0,0 +1,275 @@
# Runner-native iSCSI returned-replica reintegration chain.
#
# Goal:
# Exercise a real RF=2 iSCSI ALUA mounted failover, then restart the old
# primary and assert it returns as a non-frontend replica while r2 remains
# primary. This is the integration companion to returned-replica-component-gate.
#
# Expected invocation:
# swblock run \
# -env product_root=/path/to/seaweed_block/on/m02 \
# -env ssh_key=/path/to/testdev_key/on/controller \
# testops/scenarios/iscsi-returned-replica-chain.yaml
name: iscsi-returned-replica-chain
timeout: 18m
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: pre_clean
actions:
- action: pre_run_cleanup
node: m02
kill_patterns: "blockmaster,blockvolume,iscsi-target"
unmount: "/tmp/sw-block-iscsi-returned/mnt"
nvme_disconnect: "true"
iscsi_logout_prefix: "iqn.2026-05.io.seaweedfs"
- action: exec
node: m02
cmd: "rm -rf /mnt/smb/work/share/g15d-k8s/{{ run_id }}-iscsi-returned-chain && mkdir -p /mnt/smb/work/share/g15d-k8s/{{ run_id }}-iscsi-returned-chain/bin /mnt/smb/work/share/g15d-k8s/{{ run_id }}-iscsi-returned-chain/pin_build /mnt/smb/work/share/g15d-k8s/{{ run_id }}-iscsi-returned-chain/returned_failover"
- action: assert_no_active_iscsi_sessions
node: m02
iqn_substr: "io.seaweedfs"
- action: assert_no_processes
node: m02
pattern: "[/]blockmaster --|[/]blockvolume --|^blockmaster |^blockvolume "
- name: pin_build
actions:
- action: exec
node: m02
timeout: 8m
cmd: "cd {{ product_root }} && go build -o /mnt/smb/work/share/g15d-k8s/{{ run_id }}-iscsi-returned-chain/bin/blockmaster ./cmd/blockmaster && go build -o /mnt/smb/work/share/g15d-k8s/{{ run_id }}-iscsi-returned-chain/bin/blockvolume ./cmd/blockvolume"
- action: exec
node: m02
cmd: "cd {{ product_root }} && git rev-parse HEAD > /mnt/smb/work/share/g15d-k8s/{{ run_id }}-iscsi-returned-chain/pin_build/git.sha && git status --short > /mnt/smb/work/share/g15d-k8s/{{ run_id }}-iscsi-returned-chain/pin_build/git.status && /mnt/smb/work/share/g15d-k8s/{{ run_id }}-iscsi-returned-chain/bin/blockmaster --version > /mnt/smb/work/share/g15d-k8s/{{ run_id }}-iscsi-returned-chain/pin_build/blockmaster.version.txt && /mnt/smb/work/share/g15d-k8s/{{ run_id }}-iscsi-returned-chain/bin/blockvolume --version > /mnt/smb/work/share/g15d-k8s/{{ run_id }}-iscsi-returned-chain/pin_build/blockvolume.version.txt"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-iscsi-returned-chain/pin_build/blockvolume.version.txt"
pattern: "blockvolume revision="
save_as: blockvolume_version_count
- action: assert_greater
actual: "{{ blockvolume_version_count }}"
threshold: "0"
- name: returned_failover
actions:
- action: exec
node: m02
timeout: 10m
cmd: "cd {{ product_root }} && bash scripts/run-iscsi-alua-mounted-failover-smoke.sh {{ product_root }}"
env.SW_BLOCK_ARTIFACT_DIR: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-iscsi-returned-chain/returned_failover"
env.SW_BLOCK_BIN_DIR: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-iscsi-returned-chain/bin"
env.SW_BLOCK_ISCSI_FAILOVER_WORK_DIR: "/tmp/sw-block-iscsi-returned"
env.SW_BLOCK_RETURN_R1_AFTER_FAILOVER: "1"
env.SW_BLOCK_DEGRADED_PROBE_INTERVAL: "1s"
env.SW_BLOCK_DEGRADED_PROBE_COOLDOWN_BASE: "1s"
env.SW_BLOCK_DEGRADED_PROBE_COOLDOWN_CAP: "3s"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-iscsi-returned-chain/returned_failover/run.log"
pattern: "\\[iscsi-failover\\] PASS:"
save_as: failover_pass_count
- action: assert_greater
actual: "{{ failover_pass_count }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-iscsi-returned-chain/returned_failover/run.log"
pattern: "restart returned r1 after r2 promotion"
save_as: r1_return_phase_count
- action: assert_greater
actual: "{{ r1_return_phase_count }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-iscsi-returned-chain/returned_failover/pre-check-after-failover.log"
pattern: "/pre.bin: OK"
save_as: pre_checksum_count
- action: assert_greater
actual: "{{ pre_checksum_count }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-iscsi-returned-chain/returned_failover/post-check.log"
pattern: "/post.bin: OK"
save_as: post_checksum_count
- action: assert_greater
actual: "{{ post_checksum_count }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-iscsi-returned-chain/returned_failover/status-r2-healthy.json"
pattern: "\"AuthorityRole\":\"primary\""
save_as: r2_primary_count
- action: assert_greater
actual: "{{ r2_primary_count }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-iscsi-returned-chain/returned_failover/status-r1-returned.summary"
pattern: "^authority_non_primary=true$"
save_as: r1_nonprimary_summary_count
- action: assert_greater
actual: "{{ r1_nonprimary_summary_count }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-iscsi-returned-chain/returned_failover/status-r1-returned.summary"
pattern: "^frontend_primary_ready=false$"
save_as: r1_frontend_not_ready_summary_count
- action: assert_greater
actual: "{{ r1_frontend_not_ready_summary_count }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-iscsi-returned-chain/returned_failover/status-r1-returned.summary"
pattern: "^healthy=false$"
save_as: r1_not_healthy_summary_count
- action: assert_greater
actual: "{{ r1_not_healthy_summary_count }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-iscsi-returned-chain/returned_failover/status-r2-after-r1-return.json"
pattern: "\"AuthorityRole\":\"primary\""
save_as: r2_still_primary_count
- action: assert_greater
actual: "{{ r2_still_primary_count }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-iscsi-returned-chain/returned_failover/status-r2-after-r1-return.json"
pattern: "\"FrontendPrimaryReady\":true"
save_as: r2_still_frontend_ready_count
- action: assert_greater
actual: "{{ r2_still_frontend_ready_count }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-iscsi-returned-chain/returned_failover/status-r2-after-r1-return.json"
pattern: "\"Healthy\":true"
save_as: r2_still_healthy_count
- action: assert_greater
actual: "{{ r2_still_healthy_count }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-iscsi-returned-chain/returned_failover/status-r2-peers-after-r1-return.json"
pattern: "\"ReplicaID\":\"r1\""
save_as: r1_peer_present_count
- action: assert_greater
actual: "{{ r1_peer_present_count }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-iscsi-returned-chain/returned_failover/status-r2-peers-after-r1-return.json"
pattern: "\"State\":\"healthy\""
save_as: r1_peer_healthy_count
- action: assert_greater
actual: "{{ r1_peer_healthy_count }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-iscsi-returned-chain/returned_failover/status-r2-peers-after-r1-return.json"
pattern: "\"Epoch\":2"
save_as: r1_peer_epoch_count
- action: assert_greater
actual: "{{ r1_peer_epoch_count }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-iscsi-returned-chain/returned_failover/status-r2-peers-after-r1-return.json"
pattern: "\"ProbeInFlight\":false"
save_as: r1_peer_probe_idle_count
- action: assert_greater
actual: "{{ r1_peer_probe_idle_count }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-iscsi-returned-chain/returned_failover/status-r2-peers-after-r1-return.json"
pattern: "\"Closed\":false"
save_as: r1_peer_open_count
- action: assert_greater
actual: "{{ r1_peer_open_count }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-iscsi-returned-chain/returned_failover/blockvolume-r1-returned.log"
pattern: "durable recovered: recovered LSN="
save_as: r1_returned_local_recovery_count
- action: assert_greater
actual: "{{ r1_returned_local_recovery_count }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-iscsi-returned-chain/returned_failover/blockvolume-r1-returned.log"
pattern: "authority is now .*not this replica"
save_as: r1_returned_supersede_observed_count
- action: assert_greater
actual: "{{ r1_returned_supersede_observed_count }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-iscsi-returned-chain/returned_failover/status-durable-r2-primary-after-r1-return.summary"
pattern: "^replica=r2$"
save_as: r2_durable_replica_count
- action: assert_greater
actual: "{{ r2_durable_replica_count }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-iscsi-returned-chain/returned_failover/status-durable-r2-primary-after-r1-return.summary"
pattern: "^epoch_gte_2=true$"
save_as: r2_durable_epoch_gte_2_count
- action: assert_greater
actual: "{{ r2_durable_epoch_gte_2_count }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-iscsi-returned-chain/returned_failover/status-durable-r2-primary-after-r1-return.summary"
pattern: "^operational=true$"
save_as: r2_durable_operational_count
- action: assert_greater
actual: "{{ r2_durable_operational_count }}"
threshold: "0"
- action: assert_no_active_iscsi_sessions
node: m02
iqn_substr: "io.seaweedfs"
- action: assert_no_processes
node: m02
pattern: "[/]blockmaster --|[/]blockvolume --|^blockmaster |^blockvolume "
- name: final_asserts
actions:
- action: assert_no_active_iscsi_sessions
node: m02
iqn_substr: "io.seaweedfs"
- action: assert_no_processes
node: m02
pattern: "[/]blockmaster --|[/]blockvolume --|^blockmaster |^blockvolume "
- name: collect_and_cleanup
always: true
actions:
- action: pre_run_cleanup
node: m02
kill_patterns: "blockmaster,blockvolume,iscsi-target"
unmount: "/tmp/sw-block-iscsi-returned/mnt"
nvme_disconnect: "true"
iscsi_logout_prefix: "iqn.2026-05.io.seaweedfs"
- action: collect_path
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-iscsi-returned-chain"
name: "remote-phases"
ignore_error: true
@@ -6,9 +6,10 @@
# -> final cleanup/asserts -> shared artifact collection.
#
# Expected invocation from sw-test-runner-standalone:
# swblock run testops/scenarios/nvme-p4-multipath-failover-chain.yaml \
# --env product_root=/path/to/seaweed_block/on/m02 \
# --env ssh_key=/path/to/testdev_key/on/controller
# swblock run \
# -env product_root=/path/to/seaweed_block/on/m02 \
# -env ssh_key=/path/to/testdev_key/on/controller \
# testops/scenarios/nvme-p4-multipath-failover-chain.yaml
name: nvme-p4-multipath-failover-chain
timeout: 25m
@@ -6,9 +6,10 @@
# regression -> assert cleanup -> collect remote artifacts.
#
# Expected invocation from sw-test-runner-standalone:
# swblock run testops/scenarios/nvme-p5-csi-protocol-chain.yaml \
# --env product_root=/path/to/seaweed_block/on/m02 \
# --env ssh_key=/path/to/testdev_key/on/controller
# swblock run \
# -env product_root=/path/to/seaweed_block/on/m02 \
# -env ssh_key=/path/to/testdev_key/on/controller \
# testops/scenarios/nvme-p5-csi-protocol-chain.yaml
name: nvme-p5-csi-protocol-chain
timeout: 25m
@@ -0,0 +1,142 @@
# Runner-native NVMe-P5 protocol component gate.
#
# Goal:
# Pin the StorageClass/CSI/lifecycle/launcher protocol-shape contract without
# launching k3s or attaching an initiator. The full nvme-p5-csi-protocol
# chain remains the end-to-end proof; this gate is the fast developer loop.
#
# Expected invocation:
# swblock run \
# -env product_root=/path/to/seaweed_block/on/m02 \
# -env ssh_key=/path/to/testdev_key/on/controller \
# testops/scenarios/nvme-p5-protocol-component-gate.yaml
name: nvme-p5-protocol-component-gate
timeout: 5m
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: pre_clean
actions:
- action: assert_no_active_iscsi_sessions
node: m02
iqn_substr: "io.seaweedfs"
- action: assert_no_processes
node: m02
pattern: "[/]blockmaster --|[/]blockvolume --|^blockmaster |^blockvolume "
- action: exec
node: m02
cmd: "rm -rf /mnt/smb/work/share/g15d-k8s/{{ run_id }}-nvme-p5-protocol-component && mkdir -p /mnt/smb/work/share/g15d-k8s/{{ run_id }}-nvme-p5-protocol-component/pin_build"
- name: pin_build
actions:
- action: exec
node: m02
cmd: "cd {{ product_root }} && git rev-parse HEAD > /mnt/smb/work/share/g15d-k8s/{{ run_id }}-nvme-p5-protocol-component/pin_build/git.sha && git status --porcelain > /mnt/smb/work/share/g15d-k8s/{{ run_id }}-nvme-p5-protocol-component/pin_build/git.status && test ! -s /mnt/smb/work/share/g15d-k8s/{{ run_id }}-nvme-p5-protocol-component/pin_build/git.status"
- name: protocol_component_tests
actions:
- action: exec
node: m02
timeout: 3m
cmd: "cd {{ product_root }} && bash -o pipefail -c 'go test -count=1 -v ./core/csi ./core/host/master ./core/lifecycle ./core/launcher | tee /mnt/smb/work/share/g15d-k8s/{{ run_id }}-nvme-p5-protocol-component/protocol-component-go-test.log'"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-nvme-p5-protocol-component/protocol-component-go-test.log"
pattern: "PASS: TestG15c_ControllerCreateVolume_RecordsProtocolSelection"
save_as: csi_protocol_selection_count
- action: assert_greater
actual: "{{ csi_protocol_selection_count }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-nvme-p5-protocol-component/protocol-component-go-test.log"
pattern: "PASS: TestG15c_ControllerCreateVolume_RejectsConflictingProtocolParameters"
save_as: csi_protocol_conflict_count
- action: assert_greater
actual: "{{ csi_protocol_conflict_count }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-nvme-p5-protocol-component/protocol-component-go-test.log"
pattern: "PASS: TestG15c_ControllerCreateVolume_RejectsInvalidProtocol"
save_as: csi_protocol_invalid_count
- action: assert_greater
actual: "{{ csi_protocol_invalid_count }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-nvme-p5-protocol-component/protocol-component-go-test.log"
pattern: "PASS: TestG15c_LifecycleService_CreateVolumePersistsDesiredIntent"
save_as: master_lifecycle_protocol_count
- action: assert_greater
actual: "{{ master_lifecycle_protocol_count }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-nvme-p5-protocol-component/protocol-component-go-test.log"
pattern: "PASS: TestFileStore_CreateVolumePersistsProtocolSelection"
save_as: lifecycle_store_protocol_count
- action: assert_greater
actual: "{{ lifecycle_store_protocol_count }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-nvme-p5-protocol-component/protocol-component-go-test.log"
pattern: "PASS: TestG15d_WorkloadPlan_NVMeProtocolCreatesNVMeTargets"
save_as: lifecycle_nvme_plan_count
- action: assert_greater
actual: "{{ lifecycle_nvme_plan_count }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-nvme-p5-protocol-component/protocol-component-go-test.log"
pattern: "PASS: TestG15d_WorkloadPlan_BlankPoolRF2CreatesReplicaWorkloads"
save_as: lifecycle_default_iscsi_count
- action: assert_greater
actual: "{{ lifecycle_default_iscsi_count }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-nvme-p5-protocol-component/protocol-component-go-test.log"
pattern: "PASS: TestG15d_K8sRenderer_RendersNVMeBlockVolumeArgs"
save_as: launcher_nvme_render_count
- action: assert_greater
actual: "{{ launcher_nvme_render_count }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-nvme-p5-protocol-component/protocol-component-go-test.log"
pattern: "PASS: TestG15d_K8sRenderer_RendersBlockVolumeDeploymentArgs"
save_as: launcher_iscsi_render_count
- action: assert_greater
actual: "{{ launcher_iscsi_render_count }}"
threshold: "0"
- name: final_asserts
actions:
- action: assert_no_active_iscsi_sessions
node: m02
iqn_substr: "io.seaweedfs"
- action: assert_no_processes
node: m02
pattern: "[/]blockmaster --|[/]blockvolume --|^blockmaster |^blockvolume "
- name: collect_and_cleanup
always: true
actions:
- action: collect_path
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-nvme-p5-protocol-component"
name: "remote-phases"
ignore_error: true
@@ -0,0 +1,109 @@
# Runner-native operations/status diagnostics component gate.
#
# Goal:
# Prove the status-server diagnostic surfaces are present and explicitly
# guarded at component level before relying on them in beta-hardening suites.
#
# Expected invocation:
# swblock run \
# -env product_root=/path/to/seaweed_block/on/m02 \
# -env ssh_key=/path/to/testdev_key/on/controller \
# testops/scenarios/operations-status-diagnostics-chain.yaml
name: operations-status-diagnostics-chain
timeout: 5m
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: pre_clean
actions:
- action: assert_no_active_iscsi_sessions
node: m02
iqn_substr: "io.seaweedfs"
- action: assert_no_processes
node: m02
pattern: "[/]blockmaster --|[/]blockvolume --|^blockmaster |^blockvolume "
- action: exec
node: m02
cmd: "rm -rf /mnt/smb/work/share/g15d-k8s/{{ run_id }}-operations-status && mkdir -p /mnt/smb/work/share/g15d-k8s/{{ run_id }}-operations-status/pin_build"
- name: pin_build
actions:
- action: exec
node: m02
cmd: "cd {{ product_root }} && git rev-parse HEAD > /mnt/smb/work/share/g15d-k8s/{{ run_id }}-operations-status/pin_build/git.sha && git status --porcelain > /mnt/smb/work/share/g15d-k8s/{{ run_id }}-operations-status/pin_build/git.status && test ! -s /mnt/smb/work/share/g15d-k8s/{{ run_id }}-operations-status/pin_build/git.status"
- name: status_diagnostics_component_tests
actions:
- action: exec
node: m02
timeout: 3m
cmd: "cd {{ product_root }} && bash -o pipefail -c 'go test -count=1 -json -run \"TestStatusServer_(RejectsNonLoopbackBind|AcceptsLoopbackBindAndServesJSON|RecoveryEndpoint_Enabled_ReturnsEngineProjection|PeerStatusEndpoint_EnabledAfterStart_ReturnsPeerStates|DurableStatusEndpoint_EnabledAfterStart_ReturnsLineage)$\" ./core/host/volume | tee /mnt/smb/work/share/g15d-k8s/{{ run_id }}-operations-status/status-server-go-test.jsonl'"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-operations-status/status-server-go-test.jsonl"
pattern: "\"Action\":\"pass\".*\"Test\":\"TestStatusServer_RejectsNonLoopbackBind\""
save_as: status_loopback_guard_count
- action: assert_greater
actual: "{{ status_loopback_guard_count }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-operations-status/status-server-go-test.jsonl"
pattern: "\"Action\":\"pass\".*\"Test\":\"TestStatusServer_AcceptsLoopbackBindAndServesJSON\""
save_as: status_base_json_count
- action: assert_greater
actual: "{{ status_base_json_count }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-operations-status/status-server-go-test.jsonl"
pattern: "\"Action\":\"pass\".*\"Test\":\"TestStatusServer_RecoveryEndpoint_Enabled_ReturnsEngineProjection\""
save_as: status_recovery_endpoint_count
- action: assert_greater
actual: "{{ status_recovery_endpoint_count }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-operations-status/status-server-go-test.jsonl"
pattern: "\"Action\":\"pass\".*\"Test\":\"TestStatusServer_PeerStatusEndpoint_EnabledAfterStart_ReturnsPeerStates\""
save_as: status_peers_endpoint_count
- action: assert_greater
actual: "{{ status_peers_endpoint_count }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-operations-status/status-server-go-test.jsonl"
pattern: "\"Action\":\"pass\".*\"Test\":\"TestStatusServer_DurableStatusEndpoint_EnabledAfterStart_ReturnsLineage\""
save_as: status_durable_endpoint_count
- action: assert_greater
actual: "{{ status_durable_endpoint_count }}"
threshold: "0"
- name: final_asserts
actions:
- action: assert_no_active_iscsi_sessions
node: m02
iqn_substr: "io.seaweedfs"
- action: assert_no_processes
node: m02
pattern: "[/]blockmaster --|[/]blockvolume --|^blockmaster |^blockvolume "
- name: collect_and_cleanup
always: true
actions:
- action: collect_path
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-operations-status"
name: "remote-phases"
ignore_error: true
@@ -0,0 +1,193 @@
# Runner-native operations volume-status report component gate.
#
# Goal:
# Pin the first operations-layer read-only status report contract without
# starting blockmaster/blockvolume, k3s, iSCSI, or NVMe. This proves schema
# shape, frontend identity preservation, unavailable-field handling, and
# residue copy behavior before any operator surface is built around it.
#
# This is an observability/status report. It is not a block/data snapshot.
#
# Expected invocation:
# swblock run \
# -env product_root=/path/to/seaweed_block/on/m02 \
# -env ssh_key=/path/to/testdev_key/on/controller \
# testops/scenarios/operations-volume-status-report-component-gate.yaml
name: operations-volume-status-report-component-gate
timeout: 5m
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: pre_clean
actions:
- action: assert_no_active_iscsi_sessions
node: m02
iqn_substr: "io.seaweedfs"
- action: assert_no_processes
node: m02
pattern: "[/]blockmaster --|[/]blockvolume --|^blockmaster |^blockvolume "
- action: exec
node: m02
cmd: "rm -rf /mnt/smb/work/share/g15d-k8s/{{ run_id }}-ops-volume-status-report && mkdir -p /mnt/smb/work/share/g15d-k8s/{{ run_id }}-ops-volume-status-report/pin_build"
- name: pin_build
actions:
- action: exec
node: m02
cmd: "cd {{ product_root }} && git rev-parse HEAD > /mnt/smb/work/share/g15d-k8s/{{ run_id }}-ops-volume-status-report/pin_build/git.sha && git status --porcelain > /mnt/smb/work/share/g15d-k8s/{{ run_id }}-ops-volume-status-report/pin_build/git.status && test ! -s /mnt/smb/work/share/g15d-k8s/{{ run_id }}-ops-volume-status-report/pin_build/git.status"
- name: report_component_tests
actions:
- action: exec
node: m02
timeout: 3m
cmd: "cd {{ product_root }} && bash -o pipefail -c 'SW_BLOCK_OPS_STATUS_REPORT_OUT=/mnt/smb/work/share/g15d-k8s/{{ run_id }}-ops-volume-status-report/volume-status-report.json go test -count=1 -json -run \"^(TestBuildVolumeStatusReport_(ComposesExistingStatusSurfaces|JSONKeepsZeroValuedFrontendIdentity|JSONSchemaShapeIsStable|UsesMasterFrontendFacts|MarksUnavailableInputsExplicitly|CopiesInputSlices|WritesSampleReportArtifact)|TestVolumeStatusReportCollector_(CollectsInjectedReadOnlySources|ReturnsPartialReportWithSourceErrors|ReturnedReplicaDurableReadyButFrontendFenced|NilSourcesProduceUnavailableReport))$\" ./core/ops | tee /mnt/smb/work/share/g15d-k8s/{{ run_id }}-ops-volume-status-report/report-component-go-test.jsonl'"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-ops-volume-status-report/report-component-go-test.jsonl"
pattern: "\"Action\":\"pass\".*\"Test\":\"TestBuildVolumeStatusReport_ComposesExistingStatusSurfaces\""
save_as: report_composition_count
- action: assert_greater
actual: "{{ report_composition_count }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-ops-volume-status-report/report-component-go-test.jsonl"
pattern: "\"Action\":\"pass\".*\"Test\":\"TestBuildVolumeStatusReport_JSONKeepsZeroValuedFrontendIdentity\""
save_as: report_zero_identity_count
- action: assert_greater
actual: "{{ report_zero_identity_count }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-ops-volume-status-report/report-component-go-test.jsonl"
pattern: "\"Action\":\"pass\".*\"Test\":\"TestBuildVolumeStatusReport_JSONSchemaShapeIsStable\""
save_as: report_schema_shape_count
- action: assert_greater
actual: "{{ report_schema_shape_count }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-ops-volume-status-report/report-component-go-test.jsonl"
pattern: "\"Action\":\"pass\".*\"Test\":\"TestBuildVolumeStatusReport_UsesMasterFrontendFacts\""
save_as: report_master_frontend_count
- action: assert_greater
actual: "{{ report_master_frontend_count }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-ops-volume-status-report/report-component-go-test.jsonl"
pattern: "\"Action\":\"pass\".*\"Test\":\"TestBuildVolumeStatusReport_MarksUnavailableInputsExplicitly\""
save_as: report_unavailable_count
- action: assert_greater
actual: "{{ report_unavailable_count }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-ops-volume-status-report/report-component-go-test.jsonl"
pattern: "\"Action\":\"pass\".*\"Test\":\"TestBuildVolumeStatusReport_CopiesInputSlices\""
save_as: report_copy_count
- action: assert_greater
actual: "{{ report_copy_count }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-ops-volume-status-report/report-component-go-test.jsonl"
pattern: "\"Action\":\"pass\".*\"Test\":\"TestBuildVolumeStatusReport_WritesSampleReportArtifact\""
save_as: report_artifact_test_count
- action: assert_greater
actual: "{{ report_artifact_test_count }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-ops-volume-status-report/report-component-go-test.jsonl"
pattern: "\"Action\":\"pass\".*\"Test\":\"TestVolumeStatusReportCollector_CollectsInjectedReadOnlySources\""
save_as: report_collector_success_count
- action: assert_greater
actual: "{{ report_collector_success_count }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-ops-volume-status-report/report-component-go-test.jsonl"
pattern: "\"Action\":\"pass\".*\"Test\":\"TestVolumeStatusReportCollector_ReturnsPartialReportWithSourceErrors\""
save_as: report_collector_partial_count
- action: assert_greater
actual: "{{ report_collector_partial_count }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-ops-volume-status-report/report-component-go-test.jsonl"
pattern: "\"Action\":\"pass\".*\"Test\":\"TestVolumeStatusReportCollector_ReturnedReplicaDurableReadyButFrontendFenced\""
save_as: report_collector_returned_count
- action: assert_greater
actual: "{{ report_collector_returned_count }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-ops-volume-status-report/report-component-go-test.jsonl"
pattern: "\"Action\":\"pass\".*\"Test\":\"TestVolumeStatusReportCollector_NilSourcesProduceUnavailableReport\""
save_as: report_collector_nil_count
- action: assert_greater
actual: "{{ report_collector_nil_count }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-ops-volume-status-report/volume-status-report.json"
pattern: "\"schema_version\": \"1.0\""
save_as: report_artifact_schema_count
- action: assert_greater
actual: "{{ report_artifact_schema_count }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-ops-volume-status-report/volume-status-report.json"
pattern: "\"volume_id\": \"v1\""
save_as: report_artifact_volume_count
- action: assert_greater
actual: "{{ report_artifact_volume_count }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-ops-volume-status-report/volume-status-report.json"
pattern: "\"lun\": 0"
save_as: report_artifact_lun_count
- action: assert_greater
actual: "{{ report_artifact_lun_count }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-ops-volume-status-report/volume-status-report.json"
pattern: "\"last_error\": \"unavailable\""
save_as: report_artifact_unavailable_count
- action: assert_greater
actual: "{{ report_artifact_unavailable_count }}"
threshold: "0"
- name: final_asserts
actions:
- action: assert_no_active_iscsi_sessions
node: m02
iqn_substr: "io.seaweedfs"
- action: assert_no_processes
node: m02
pattern: "[/]blockmaster --|[/]blockvolume --|^blockmaster |^blockvolume "
- name: collect_and_cleanup
always: true
actions:
- action: collect_path
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-ops-volume-status-report"
name: "remote-phases"
ignore_error: true
@@ -0,0 +1,102 @@
# Runner-native returned-replica component gate.
#
# Goal:
# Run fast host/volume component tests that pin returned-replica frontend
# safety semantics before adding expensive RF=2/3 Kubernetes or initiator
# scenarios.
#
# Expected invocation:
# swblock run \
# -env product_root=/path/to/seaweed_block/on/m02 \
# -env ssh_key=/path/to/testdev_key/on/controller \
# testops/scenarios/returned-replica-component-gate.yaml
name: returned-replica-component-gate
timeout: 5m
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: pre_clean
actions:
- action: assert_no_active_iscsi_sessions
node: m02
iqn_substr: "io.seaweedfs"
- action: assert_no_processes
node: m02
pattern: "[/]blockmaster --|[/]blockvolume --|^blockmaster |^blockvolume "
- action: exec
node: m02
cmd: "rm -rf /mnt/smb/work/share/g15d-k8s/{{ run_id }}-returned-replica-component && mkdir -p /mnt/smb/work/share/g15d-k8s/{{ run_id }}-returned-replica-component/pin_build"
- name: pin_build
actions:
- action: exec
node: m02
cmd: "cd {{ product_root }} && git rev-parse HEAD > /mnt/smb/work/share/g15d-k8s/{{ run_id }}-returned-replica-component/pin_build/git.sha && git status --porcelain > /mnt/smb/work/share/g15d-k8s/{{ run_id }}-returned-replica-component/pin_build/git.status && test ! -s /mnt/smb/work/share/g15d-k8s/{{ run_id }}-returned-replica-component/pin_build/git.status"
- name: returned_replica_component_tests
actions:
- action: exec
node: m02
timeout: 3m
cmd: "cd {{ product_root }} && bash -o pipefail -c 'go test -count=1 -v ./core/host/volume | tee /mnt/smb/work/share/g15d-k8s/{{ run_id }}-returned-replica-component/core-host-volume-go-test.log'"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-returned-replica-component/core-host-volume-go-test.log"
pattern: "--- PASS: TestG8A_ReturnedSupportingReplica_DoesNotServeFrontendBackend"
save_as: supporting_frontend_fence_count
- action: assert_greater
actual: "{{ supporting_frontend_fence_count }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-returned-replica-component/core-host-volume-go-test.log"
pattern: "--- PASS: TestG9B_StatusProjection_ComponentAdapterLifecycle_NotReadyRecoveringReady"
save_as: returned_lifecycle_count
- action: assert_greater
actual: "{{ returned_lifecycle_count }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-returned-replica-component/core-host-volume-go-test.log"
pattern: "--- PASS: TestG9B_StatusProjection_ReturnedReplicaCanBeDurableReadyButFrontendNotReady"
save_as: returned_durable_ready_frontend_fenced_count
- action: assert_greater
actual: "{{ returned_durable_ready_frontend_fenced_count }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-returned-replica-component/core-host-volume-go-test.log"
pattern: "--- PASS: TestG9C_StatusProjection_DualLaneRecoveredReplicaReadyAfterPostCloseAck"
save_as: dual_lane_ready_count
- action: assert_greater
actual: "{{ dual_lane_ready_count }}"
threshold: "0"
- name: final_asserts
actions:
- action: assert_no_active_iscsi_sessions
node: m02
iqn_substr: "io.seaweedfs"
- action: assert_no_processes
node: m02
pattern: "[/]blockmaster --|[/]blockvolume --|^blockmaster |^blockvolume "
- name: collect_and_cleanup
always: true
actions:
- action: collect_path
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-returned-replica-component"
name: "remote-phases"
ignore_error: true
@@ -0,0 +1,40 @@
name: beta-hardening-gate
mode: chain
# Seed runner-native beta-hardening suite.
#
# This composes the gates that are already executable today. It intentionally
# keeps each child scenario as the owner of its own cleanup and artifact
# collection. The suite layer only sequences them and emits top-level
# status/result metadata with child run pointers.
#
# Expected invocation from the controller:
# swblock suite --results-dir <root> \
# --env product_root=/tmp/seaweed-block-plan-roadmap-refresh-devrun \
# --env ssh_key=C:/work/dev_server/testdev_key \
# testops/suites/beta-hardening-gate.yaml
#
# Not yet final-close complete:
# - validate-bundle --profile beta-hardening is a runner-side follow-up.
scenarios:
- id: iscsi-p6-alua-failover
path: ../scenarios/iscsi-p6-alua-failover-chain.yaml
- id: nvme-p4-multipath-failover
path: ../scenarios/nvme-p4-multipath-failover-chain.yaml
- id: nvme-p5-csi-protocol
path: ../scenarios/nvme-p5-csi-protocol-chain.yaml
- id: iscsi-p8-compat-soak
path: ../scenarios/iscsi-p8-compat-soak-chain.yaml
- id: csi-lifecycle-component
path: ../scenarios/csi-lifecycle-component-gate.yaml
- id: csi-rf1-durable-restart
path: ../scenarios/csi-rf1-durable-restart-chain.yaml
- id: operations-status-diagnostics
path: ../scenarios/operations-status-diagnostics-chain.yaml
- id: returned-replica-component
path: ../scenarios/returned-replica-component-gate.yaml
- id: iscsi-returned-replica
path: ../scenarios/iscsi-returned-replica-chain.yaml
- id: cleanup-residue
path: ../scenarios/cleanup-residue-chain.yaml