mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-05 02:27:26 +01:00
test: add iscsi compatibility soak gate
This commit is contained in:
1 parent
ad01e78c9a
commit
e8e78b96c2
7 files changed
+370
No files matched your search
@@ -4,6 +4,7 @@ import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/binary"
|
||||
"sync"
|
||||
"testing"
|
||||
|
||||
"github.com/seaweedfs/seaweed-block/core/frontend"
|
||||
@@ -282,3 +283,66 @@ func TestP6ALUA_ReportTPGReflectsStateChanges(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestP8ALUA_ConcurrentReportTPGAndStandbyDataReject(t *testing.T) {
|
||||
rec := testback.NewRecordingBackend(frontend.Identity{VolumeID: "v1", ReplicaID: "r2"})
|
||||
payload := bytes.Repeat([]byte{0x7b}, int(iscsi.DefaultBlockSize))
|
||||
if _, err := rec.Write(context.Background(), 0, payload); err != nil {
|
||||
t.Fatalf("seed Write: %v", err)
|
||||
}
|
||||
prov := aluaTestProvider(iscsi.ALUAStandby)
|
||||
h := iscsi.NewSCSIHandler(iscsi.HandlerConfig{Backend: rec, ALUA: prov})
|
||||
|
||||
const workers = 8
|
||||
const iterations = 200
|
||||
var wg sync.WaitGroup
|
||||
errCh := make(chan string, workers*3)
|
||||
for i := 0; i < workers; i++ {
|
||||
wg.Add(3)
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
for j := 0; j < iterations; j++ {
|
||||
rtpg := h.HandleCommand(context.Background(), reportTPGCDB(64), nil)
|
||||
if rtpg.Status != iscsi.StatusGood {
|
||||
errCh <- "REPORT TPG failed"
|
||||
return
|
||||
}
|
||||
if state := iscsi.ALUAState(rtpg.Data[4] & 0x0f); state != iscsi.ALUAStandby {
|
||||
errCh <- "REPORT TPG state changed"
|
||||
return
|
||||
}
|
||||
}
|
||||
}()
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
for j := 0; j < iterations; j++ {
|
||||
read := h.HandleCommand(context.Background(), readCDB(0, 1), nil)
|
||||
if read.Status != iscsi.StatusCheckCondition {
|
||||
errCh <- "standby READ was not rejected"
|
||||
return
|
||||
}
|
||||
}
|
||||
}()
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
for j := 0; j < iterations; j++ {
|
||||
write := h.HandleCommand(context.Background(), writeCDB(0, 1), payload)
|
||||
if write.Status != iscsi.StatusCheckCondition {
|
||||
errCh <- "standby WRITE was not rejected"
|
||||
return
|
||||
}
|
||||
}
|
||||
}()
|
||||
}
|
||||
wg.Wait()
|
||||
close(errCh)
|
||||
for msg := range errCh {
|
||||
t.Fatal(msg)
|
||||
}
|
||||
if rec.ReadCount() != 0 {
|
||||
t.Fatalf("standby READ reached backend %d times", rec.ReadCount())
|
||||
}
|
||||
if rec.WriteCount() != 1 {
|
||||
t.Fatalf("standby WRITE reached backend; WriteCount=%d want seed-only 1", rec.WriteCount())
|
||||
}
|
||||
}
|
||||
@@ -410,6 +410,47 @@ References:
|
||||
record the network path in the report.
|
||||
- avoid manual benchmark notes without a repeatable scenario.
|
||||
|
||||
## Current Active 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: in progress 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 pending.
|
||||
- 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`.
|
||||
- K8s CSI soak:
|
||||
- #QA pending.
|
||||
- repeat attach/detach and fio paths with explicit iteration/runtime
|
||||
values.
|
||||
- record whether launcher owner-reference cleanup remains clean.
|
||||
- compatibility matrix:
|
||||
- #QA pending.
|
||||
- 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.
|
||||
|
||||
## Cross-Cutting Technical Rules
|
||||
|
||||
- Protocol code must not decide authority.
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
# QA Assignment: iSCSI P8 Compatibility Soak
|
||||
|
||||
Status: ready.
|
||||
Branch: `iscsi/frontend-hardening`.
|
||||
Scope: repeatable soak evidence for the current iSCSI frontend stack.
|
||||
|
||||
## Preconditions
|
||||
|
||||
- Linux host with:
|
||||
- `open-iscsi`,
|
||||
- `iscsi_tcp`,
|
||||
- `mkfs.ext4`,
|
||||
- `mount`,
|
||||
- `fio`,
|
||||
- sudo access.
|
||||
- Optional K8s steps need:
|
||||
- k3s/kubectl access,
|
||||
- local `sw-block:local` and `sw-block-csi:local` images rebuilt from this
|
||||
branch,
|
||||
- pod egress for `apk add fio`.
|
||||
- No active sw-block iSCSI sessions before the run.
|
||||
|
||||
## Run
|
||||
|
||||
OS-only soak:
|
||||
|
||||
```bash
|
||||
RUN_ID="$(date -u +%Y%m%dT%H%M%SZ)-iscsi-p8-soak" \
|
||||
SW_BLOCK_ARTIFACT_DIR="/mnt/smb/work/share/g15d-k8s/${RUN_ID}" \
|
||||
SW_BLOCK_P8_OS_ITERATIONS=2 \
|
||||
SW_BLOCK_P8_OS_FIO_RUNTIME=120 \
|
||||
SW_BLOCK_P8_OS_FIO_SIZE=128m \
|
||||
bash scripts/run-iscsi-compat-soak.sh "$PWD"
|
||||
```
|
||||
|
||||
Full lab soak with K8s fio and attach/detach:
|
||||
|
||||
```bash
|
||||
RUN_ID="$(date -u +%Y%m%dT%H%M%SZ)-iscsi-p8-soak-full" \
|
||||
SW_BLOCK_ARTIFACT_DIR="/mnt/smb/work/share/g15d-k8s/${RUN_ID}" \
|
||||
SW_BLOCK_P8_OS_ITERATIONS=2 \
|
||||
SW_BLOCK_P8_OS_FIO_RUNTIME=120 \
|
||||
SW_BLOCK_P8_OS_FIO_SIZE=128m \
|
||||
SW_BLOCK_P8_RUN_K8S_FIO=1 \
|
||||
SW_BLOCK_P8_RUN_ATTACH_LOOP=1 \
|
||||
SW_BLOCK_P8_ATTACH_ITERATIONS=3 \
|
||||
bash scripts/run-iscsi-compat-soak.sh "$PWD"
|
||||
```
|
||||
|
||||
## Expected
|
||||
|
||||
- `summary.md` has PASS rows for every enabled step.
|
||||
- OS fio step finishes all iterations.
|
||||
- If enabled, K8s fio step reaches the existing `[alpha-fio] PASS` line.
|
||||
- If enabled, attach/detach reaches the existing `[attach-loop] PASS` line.
|
||||
- Final host has no active sw-block iSCSI sessions.
|
||||
- K8s steps leave no sw-block PVC, pod, or generated blockvolume Deployment.
|
||||
|
||||
## Evidence To Report
|
||||
|
||||
- branch and commit SHA,
|
||||
- host/kernel,
|
||||
- exact command,
|
||||
- artifact root,
|
||||
- `summary.md`,
|
||||
- fio read/write lines,
|
||||
- any iSCSI session errors in daemon logs,
|
||||
- cleanup state.
|
||||
|
||||
## Non-Claims
|
||||
|
||||
- This is not a performance claim.
|
||||
- This is not a benchmark publication.
|
||||
- This is not a multi-host, RoCE, NVMe, or long soak claim.
|
||||
- K8s evidence is single-node unless the report explicitly says otherwise.
|
||||
@@ -370,6 +370,48 @@ func TestISCSIP7BackendFioMatrixRegistrationBuildsShellDriver(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestISCSIP8CompatSoakRegistrationBuildsShellDriver(t *testing.T) {
|
||||
repoRoot := findRepoRoot(t)
|
||||
raw, err := os.Open(registrationPath(repoRoot, "iscsi-p8-compat-soak.json"))
|
||||
if err != nil {
|
||||
t.Fatalf("open registration: %v", err)
|
||||
}
|
||||
defer raw.Close()
|
||||
|
||||
registration, err := DecodeRegistration(raw)
|
||||
if err != nil {
|
||||
t.Fatalf("DecodeRegistration: %v", err)
|
||||
}
|
||||
if registration.Scenario != "iscsi-p8-compat-soak" || registration.Driver.Type != "shell" {
|
||||
t.Fatalf("registration=%+v", registration)
|
||||
}
|
||||
driver, err := registration.NewDriver(repoRoot)
|
||||
if err != nil {
|
||||
t.Fatalf("NewDriver: %v", err)
|
||||
}
|
||||
shell, ok := driver.(ShellDriver)
|
||||
if !ok {
|
||||
t.Fatalf("driver type=%T want ShellDriver", driver)
|
||||
}
|
||||
if !filepath.IsAbs(shell.Path) || filepath.Base(shell.Path) != "run-iscsi-compat-soak.sh" {
|
||||
t.Fatalf("shell path=%q", shell.Path)
|
||||
}
|
||||
if _, err := os.Stat(shell.Path); err != nil {
|
||||
t.Fatalf("shell driver path missing: %v", err)
|
||||
}
|
||||
for _, want := range []string{"summary.md", "os-fio-repeat/fio.iter*.log", "os-fio-repeat/iscsi-sessions.final.txt"} {
|
||||
if !containsString(registration.Artifacts, want) {
|
||||
t.Fatalf("registration artifacts missing %q: %v", want, registration.Artifacts)
|
||||
}
|
||||
}
|
||||
if got := registration.ScenarioDefaultParams["SW_BLOCK_P8_OS_FIO_RUNTIME"]; got != "120" {
|
||||
t.Fatalf("default OS fio runtime=%q want 120", got)
|
||||
}
|
||||
if !containsString(registration.NonClaims, "Not a product performance claim.") {
|
||||
t.Fatalf("registration must keep performance non-claim: %v", registration.NonClaims)
|
||||
}
|
||||
}
|
||||
|
||||
func containsString(values []string, want string) bool {
|
||||
for _, value := range values {
|
||||
if value == want {
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
{
|
||||
"schema_version": "1.0",
|
||||
"scenario": "iscsi-p8-compat-soak",
|
||||
"gate": "iSCSI-P8",
|
||||
"layer": "L3-privileged-host",
|
||||
"driver": {
|
||||
"type": "shell",
|
||||
"path": "scripts/run-iscsi-compat-soak.sh"
|
||||
},
|
||||
"default_timeout_s": 3600,
|
||||
"required_capabilities": [
|
||||
"bash",
|
||||
"linux",
|
||||
"sudo",
|
||||
"iscsiadm",
|
||||
"iscsi_tcp-loadable",
|
||||
"mkfs.ext4",
|
||||
"mount",
|
||||
"fio"
|
||||
],
|
||||
"scenario_default_params": {
|
||||
"SW_BLOCK_P8_OS_ITERATIONS": "2",
|
||||
"SW_BLOCK_P8_OS_FIO_RUNTIME": "120",
|
||||
"SW_BLOCK_P8_OS_FIO_SIZE": "128m"
|
||||
},
|
||||
"qa_instruction": "internal/docs/qa-assignments/iscsi-p8-compat-soak-validation.md",
|
||||
"known_green_commit": "",
|
||||
"artifacts": [
|
||||
"summary.md",
|
||||
"run.log",
|
||||
"os-fio-repeat/run.log",
|
||||
"os-fio-repeat/blockmaster.log",
|
||||
"os-fio-repeat/blockvolume.log",
|
||||
"os-fio-repeat/fio.iter*.log",
|
||||
"os-fio-repeat/iscsi-sessions.final.txt",
|
||||
"k8s-fio/run.log",
|
||||
"k8s-attach-detach/summary.log"
|
||||
],
|
||||
"non_claims": [
|
||||
"Compatibility and soak evidence only.",
|
||||
"Not a product performance claim.",
|
||||
"Default path is single-host Linux iSCSI.",
|
||||
"Kubernetes steps are opt-in and single-node unless stated otherwise."
|
||||
]
|
||||
}
|
||||
@@ -21,6 +21,7 @@ This directory contains developer and QA helper scripts.
|
||||
| `run-alpha-app-demo.sh` | App-demo implementation used by `run-k8s-demo.sh`. |
|
||||
| `run-iscsi-os-smoke.sh` | Privileged Linux OS-initiator smoke: `iscsiadm` -> `mkfs.ext4` -> mount -> checksum -> logout on a 256 MiB target. |
|
||||
| `run-iscsi-backend-fio-matrix.sh` | Privileged Linux OS-initiator backend matrix: runs the same fio workload against `walstore` and `smartwal`, writing per-backend artifacts and an experimental summary. |
|
||||
| `run-iscsi-compat-soak.sh` | Privileged compatibility soak wrapper: runs OS fio repeat and optional K8s fio / attach-detach steps with one summary. |
|
||||
| `run-iscsi-alua-os-smoke.sh` | Privileged Linux OS-initiator smoke for ALUA reporting: `iscsiadm` -> `sg_inq`/`sg_rtpg` -> mount -> checksum -> logout. |
|
||||
| `run-iscsi-alua-multipath-smoke.sh` | Privileged Linux OS-initiator smoke for two iSCSI paths: two portals -> ALUA active/standby evidence -> standby write reject -> `multipath -ll`. |
|
||||
| `run-iscsi-alua-mounted-failover-smoke.sh` | Privileged Linux OS-initiator smoke for mounted multipath failover: mount `/dev/mapper/*`, kill active path, wait r2 primary, verify checksum read/write. |
|
||||
|
||||
+102
@@ -0,0 +1,102 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
ROOT="${1:-$(pwd)}"
|
||||
RUN_ID="${RUN_ID:-$(date -u +%Y%m%dT%H%M%SZ)}"
|
||||
ARTIFACT_ROOT="${SW_BLOCK_ARTIFACT_DIR:-/tmp/sw-block-iscsi-compat-soak-${RUN_ID}}"
|
||||
OS_ITERATIONS="${SW_BLOCK_P8_OS_ITERATIONS:-2}"
|
||||
OS_FIO_RUNTIME="${SW_BLOCK_P8_OS_FIO_RUNTIME:-120}"
|
||||
OS_FIO_SIZE="${SW_BLOCK_P8_OS_FIO_SIZE:-128m}"
|
||||
RUN_K8S_FIO="${SW_BLOCK_P8_RUN_K8S_FIO:-0}"
|
||||
RUN_ATTACH_LOOP="${SW_BLOCK_P8_RUN_ATTACH_LOOP:-0}"
|
||||
ATTACH_ITERATIONS="${SW_BLOCK_P8_ATTACH_ITERATIONS:-3}"
|
||||
|
||||
mkdir -p "$ARTIFACT_ROOT"
|
||||
|
||||
log() {
|
||||
printf '[iscsi-soak] %s\n' "$*" | tee -a "$ARTIFACT_ROOT/run.log"
|
||||
}
|
||||
|
||||
require_cmd() {
|
||||
if ! command -v "$1" >/dev/null 2>&1; then
|
||||
echo "missing required command: $1" >&2
|
||||
exit 2
|
||||
fi
|
||||
}
|
||||
|
||||
require_cmd bash
|
||||
require_cmd grep
|
||||
require_cmd tee
|
||||
|
||||
log "run_id=$RUN_ID"
|
||||
log "root=$ROOT"
|
||||
log "artifact_root=$ARTIFACT_ROOT"
|
||||
log "os_iterations=$OS_ITERATIONS"
|
||||
log "os_fio_runtime=${OS_FIO_RUNTIME}s"
|
||||
log "os_fio_size=$OS_FIO_SIZE"
|
||||
log "run_k8s_fio=$RUN_K8S_FIO"
|
||||
log "run_attach_loop=$RUN_ATTACH_LOOP"
|
||||
|
||||
summary="$ARTIFACT_ROOT/summary.md"
|
||||
cat >"$summary" <<EOF
|
||||
# iSCSI P8 Compatibility Soak
|
||||
|
||||
Run ID: \`$RUN_ID\`
|
||||
Root: \`$ROOT\`
|
||||
|
||||
This is compatibility and soak evidence. It is not a product performance
|
||||
claim.
|
||||
|
||||
| Step | Result | Artifact |
|
||||
|---|---|---|
|
||||
EOF
|
||||
|
||||
overall=0
|
||||
|
||||
run_step() {
|
||||
local name="$1"
|
||||
local artifact="$2"
|
||||
shift 2
|
||||
mkdir -p "$artifact"
|
||||
log "start ${name}"
|
||||
if "$@" >"$artifact/stdout.log" 2>"$artifact/stderr.log"; then
|
||||
log "${name}: PASS"
|
||||
printf '| `%s` | `PASS` | `%s` |\n' "$name" "$artifact" >>"$summary"
|
||||
else
|
||||
log "${name}: FAIL"
|
||||
printf '| `%s` | `FAIL` | `%s` |\n' "$name" "$artifact" >>"$summary"
|
||||
overall=1
|
||||
fi
|
||||
}
|
||||
|
||||
run_step "os-fio-repeat" "$ARTIFACT_ROOT/os-fio-repeat" \
|
||||
env \
|
||||
SW_BLOCK_ARTIFACT_DIR="$ARTIFACT_ROOT/os-fio-repeat" \
|
||||
SW_BLOCK_ISCSI_ITERATIONS="$OS_ITERATIONS" \
|
||||
SW_BLOCK_ISCSI_STRESS=fio \
|
||||
SW_BLOCK_ISCSI_FIO_RUNTIME="$OS_FIO_RUNTIME" \
|
||||
SW_BLOCK_ISCSI_FIO_SIZE="$OS_FIO_SIZE" \
|
||||
bash "$ROOT/scripts/run-iscsi-os-smoke.sh" "$ROOT"
|
||||
|
||||
if [[ "$RUN_K8S_FIO" == "1" || "$RUN_K8S_FIO" == "true" ]]; then
|
||||
run_step "k8s-fio" "$ARTIFACT_ROOT/k8s-fio" \
|
||||
env \
|
||||
SW_BLOCK_ARTIFACT_DIR="$ARTIFACT_ROOT/k8s-fio" \
|
||||
bash "$ROOT/scripts/run-k8s-alpha-fio.sh" "$ROOT"
|
||||
fi
|
||||
|
||||
if [[ "$RUN_ATTACH_LOOP" == "1" || "$RUN_ATTACH_LOOP" == "true" ]]; then
|
||||
run_step "k8s-attach-detach" "$ARTIFACT_ROOT/k8s-attach-detach" \
|
||||
env \
|
||||
SW_BLOCK_ARTIFACT_DIR="$ARTIFACT_ROOT/k8s-attach-detach" \
|
||||
SW_BLOCK_ATTACH_DETACH_ITERATIONS="$ATTACH_ITERATIONS" \
|
||||
bash "$ROOT/scripts/run-k8s-attach-detach-loop.sh" "$ROOT"
|
||||
fi
|
||||
|
||||
log "summary=$summary"
|
||||
if [[ "$overall" -ne 0 ]]; then
|
||||
log "FAIL: one or more soak steps failed"
|
||||
exit "$overall"
|
||||
fi
|
||||
|
||||
log "PASS: compatibility soak completed"
|
||||
Reference in new issue
Block a user