phase111: prove nvme k8s path-loss crd honesty (#62)

This commit is contained in:
Ping Qiu authored and GitHub committed 2026-06-29 21:41:34 -07:00
1 parent 9b4e5876d6
commit 6ab5f7c68f
6 files changed
+617 -67

No files matched your search

+10
View File
@@ -548,6 +548,16 @@ Recommended order from here:
`multipath_observed=false`, `mutation_allowed=false`, and zero false
`Ready=True`. This is support-surface replay of real standalone path-loss
evidence, not a live Kubernetes CRD negative-path-loss claim.
69. Phase 111: NVMe/TCP K8s Path-Loss CRD Honesty. **Closed 2026-06-29,
runner PASS**
Closed the Phase 110 non-claim in the live Kubernetes path. A real RF=2
NVMe/TCP PVC first reached `SwBlockVolume.status.nvme.pathCount=2` and
`Ready=True/first_volume_verified`; then one generated blockvolume
deployment was scaled to zero, reducing the observed NVMe path count to one.
`SwBlockVolume.status`, report summary, report `operator-snapshot.json`,
dashboard `/operator-snapshot.json`, and `ops explain` all converged on
`blocked/nvme_multipath_path_missing` with no false volume `Ready=True`,
`mutation_allowed=false`, and zero cleanup residue.
The internal release-train contract is
`internal/docs/ref/operation-layer-v0.5-release-train.md`. Phases 41-44 close
+44 -67
View File
@@ -1,112 +1,89 @@
# Current Plan: Phase 110 NVMe/TCP Path-Loss Status Surface Honesty
# Current Plan: Phase 111 NVMe/TCP K8s Path-Loss CRD Honesty
Status: closed.
QA run `20260629-210857-5c3b` passed 23/23 actions. Sign-off:
`internal/docs/qa-assignments/phase110-nvme-tcp-path-loss-status-surface-qa-signoff.md`.
QA run `20260629-213354-02a1` passed 19/19 actions. Sign-off:
`internal/docs/qa-assignments/phase111-nvme-k8s-path-loss-crd-qa-signoff.md`.
## Why This Is Next
Phase 109 proved healthy NVMe/TCP identity across CRD, report,
operator-snapshot, dashboard, and explain. Phase 101 already proved the live
standalone one-path-loss behavior: a mounted NVMe/TCP workload survives losing
one path, and the product must not claim `Ready=True` while only one of the
expected two paths remains.
Phase 110 deliberately stopped at support-surface replay of real standalone
path-loss evidence. That was useful, but it left one important non-claim:
Kubernetes `SwBlockVolume.status` had not yet been proven to turn a live RF=2
NVMe/TCP path loss into a non-ready CRD status.
The remaining risk is negative visibility. A transport can detect path loss but
still be operationally unsafe if support surfaces replay stale or over-optimistic
state. Phase 110 turns the real Phase 101 path-loss evidence into a support
bundle and proves every user-facing cold-reader surface preserves the same
non-ready reason.
Phase 111 closes that gap. It starts from the real Kubernetes CSI path, creates
one RF=2 NVMe/TCP PVC, verifies the healthy two-path CRD state, then removes one
launcher-managed blockvolume path by scaling one generated deployment to zero.
The launcher reconciler explicitly preserves an operator-scaled-zero deployment,
so this is a stable and product-representative path-loss injection rather than a
race against the reconciler.
## Product Goal
Prove that real NVMe/TCP one-path-loss evidence replays as
`blocked/nvme_multipath_path_missing` across report, operator-snapshot,
dashboard, and explain, with no false `Ready=True` and no mutating action.
Prove that live Kubernetes NVMe/TCP path loss projects to
`SwBlockVolume.status` and every read-only support surface as
`blocked/nvme_multipath_path_missing`, with no false `Ready=True` and no
mutating action.
Required behavior:
- run the existing live mounted NVMe/TCP failover/path-loss script;
- confirm live source evidence starts with two paths and ends with one path;
- confirm live source reason is `nvme_multipath_path_missing`;
- normalize `cluster-after-failover.json` into
`product-observation/cluster-evidence.json`;
- replay with `sw-block ops report --from-bundle`;
- replay with `sw-block ops dashboard --from-bundle`;
- replay with `sw-block ops explain volume --from-bundle`;
- prove all surfaces agree on `blocked/nvme_multipath_path_missing`;
- prove `Ready=True` is absent everywhere;
- cleanup leaves zero NVMe residue.
- install Helm with two ready nodes, `protocol=nvme`, operator-status enabled,
lifecycle-owner enabled, and RF=2;
- create one PVC through CSI and verify writer/reader data path;
- wait for `SwBlockVolume.status.nvme.pathCount=2` and
`Ready=True/first_volume_verified`;
- scale one generated `sw-blockvolume` deployment to zero;
- wait for `SwBlockVolume.status.nvme.pathCount=1` and
`blocked/nvme_multipath_path_missing`;
- prove report, operator-snapshot, dashboard, and explain agree with the CRD;
- prove no volume surface claims `Ready=True`;
- cleanup leaves zero Kubernetes/NVMe/iSCSI/process/multipath/hostPath residue.
## D1: Live Source Gate
## Gate
Scenario:
```text
testops/scenarios/nvme-tcp-path-loss-status-surface-chain.yaml
testops/scenarios/nvme-tcp-k8s-path-loss-crd-chain.yaml
```
Expected terminal evidence:
Gate script:
```text
phase101_nvme_path_failure_status=ok
before_path_count=2
after_path_count=1
after_nvme_reason=nvme_multipath_path_missing
after_ready_true=false
final_nvme_residue_count=0
scripts/run-phase111-nvme-k8s-path-loss-crd-gate.sh
```
Actual evidence:
Terminal evidence:
```text
phase101_nvme_path_failure_status=ok
phase111_nvme_k8s_path_loss_crd_status=ok
before_path_count=2
after_path_count=1
after_nvme_reason=nvme_multipath_path_missing
after_ready_true=false
final_nvme_residue_count=0
```
## D2: Support Surface Replay Gate
Expected terminal evidence:
```text
phase110_nvme_tcp_path_loss_status_surface_status=ok
live_path_loss_source=phase101
before_path_count=2
after_path_count=1
after_nvme_reason=nvme_multipath_path_missing
after_ready_true=false
crd_reason=nvme_multipath_path_missing
report_reason=nvme_multipath_path_missing
operator_snapshot_reason=nvme_multipath_path_missing
dashboard_reason=nvme_multipath_path_missing
explain_reason=nvme_multipath_path_missing
surface_ready_true_count=0
mutation_allowed=false
cleanup_status=ok
```
Actual evidence matched the expected keys exactly.
## Result
## D3: Cleanup Gate
Expected terminal evidence:
```text
final_nvme_residue_count=0
```
Actual source and final cleanup evidence matched the expected key.
Phase 111 passed on live k3s. The CRD and all read-only support surfaces agree
that a one-path RF=2 NVMe/TCP volume is blocked with
`nvme_multipath_path_missing`. The healthy source state had two NVMe paths; the
post-injection state had one path; no volume surface claimed `Ready=True`.
## Non-Claims
Phase 110 does not claim:
Phase 111 does not claim:
- RoCE/NVMe-RDMA;
- performance or SLO;
- broad distro/kernel compatibility;
- production HA;
- live Kubernetes CRD negative projection for NVMe path loss;
- more than support-surface replay of real standalone one-path-loss evidence.
- automatic rebuild or path restoration;
- more than the supported lab Kubernetes NVMe/TCP path-loss status behavior.
@@ -283,6 +283,13 @@ rebuild, delete safety, or cleanup must start as a separate gated phase.
`multipath_observed=false`, read-only actions, and no false `Ready=True`.
This deliberately remains a support-surface replay gate, not a live
Kubernetes CRD negative-path-loss claim.
- Phase 111 NVMe/TCP K8s Path-Loss CRD Honesty is closed. The supported-lab
Kubernetes path now proves the same negative behavior through the authoritative
CRD: one RF=2 NVMe/TCP PVC starts with two observed paths and
`Ready=True/first_volume_verified`; scaling one generated blockvolume
deployment to zero reduces the path count to one, and `SwBlockVolume.status`,
report, operator-snapshot, dashboard, and explain all report
`blocked/nvme_multipath_path_missing` with no false volume `Ready=True`.
- Later protocol candidates: implement a real NVMe/RDMA target or characterize
NVMe/TCP performance. Keep these separate so correctness, transport, and
performance claims do not get mixed.
@@ -0,0 +1,111 @@
# Phase 111 NVMe/TCP K8s Path-Loss CRD Honesty QA Sign-off
Status: PASS.
Validated scenario:
```text
testops/scenarios/nvme-tcp-k8s-path-loss-crd-chain.yaml
```
Final QA run:
```text
20260629-213354-02a1
```
Result:
```text
19/19 actions PASS
```
## Scope
Phase 111 closes the Phase 110 non-claim: live Kubernetes CRD projection for
NVMe/TCP path loss.
The gate installs the Helm stack with:
- `protocol=nvme`
- two selected Kubernetes nodes
- `replicationFactor=2`
- operator-status enabled in write mode
- lifecycle-owner enabled
It creates one RF=2 NVMe/TCP PVC, verifies writer/reader data path, waits for a
healthy two-path `SwBlockVolume.status.nvme`, scales one generated
`sw-blockvolume` deployment to zero, then verifies every read-only status
surface refuses to claim `Ready=True`.
## Terminal Evidence
```text
phase111_nvme_k8s_path_loss_crd_status=ok
before_path_count=2
after_path_count=1
crd_reason=nvme_multipath_path_missing
report_reason=nvme_multipath_path_missing
operator_snapshot_reason=nvme_multipath_path_missing
dashboard_reason=nvme_multipath_path_missing
explain_reason=nvme_multipath_path_missing
surface_ready_true_count=0
mutation_allowed=false
cleanup_status=ok
```
Cleanup verifier:
```text
cleanup_status=ok
k8s_residue_count=0
iscsi_residue_count=0
process_residue_count=0
multipath_residue_count=0
hostpath_residue_count=0
failure_count=0
```
## Gate Results
| Check | Result | Evidence |
| --- | --- | --- |
| Healthy source path | PASS | `SwBlockVolume.status.nvme.pathCount=2`, `status=ready`, `reasonCode=first_volume_verified` |
| Injection | PASS | scaled one generated `sw-blockvolume` deployment to zero; launcher preserves scaled-zero deployments |
| CRD negative projection | PASS | `status=blocked`, `reasonCode=nvme_multipath_path_missing`, `pathCount=1`, Ready condition `False` |
| Report summary | PASS | `managed_volume=<id> status=blocked reason=nvme_multipath_path_missing`; NVMe `path_count=1` |
| Operator snapshot | PASS | volume status `blocked`, reason `nvme_multipath_path_missing`, `nvme.path_count=1` |
| Dashboard snapshot | PASS | `/operator-snapshot.json` matches report operator snapshot |
| Explain | PASS | `ops explain volume --from-bundle` reports `blocked/nvme_multipath_path_missing` and path count 1 |
| Mutation boundary | PASS | only `observe.collect_bundle`, `mutation_allowed=false`; no repair/rebuild/failback/delete claim |
| Cleanup | PASS | zero residue across Kubernetes, iSCSI, process, multipath, hostPath; NVMe disconnected |
## Harness Notes
Two initial red runs were gate-authoring defects, not product defects:
- The first run used the PVC/CR name for `ops explain --from-bundle`; the bundle
lookup requires the internal `volumeID`.
- The second run treated node-level `ready=true` lines as false volume
`Ready=True`. The final gate now checks volume readiness conditions only.
The product evidence in both reruns already showed the correct CRD/report/
dashboard state. The final run confirms the corrected gate end-to-end.
## Verdict
PASS. Live Kubernetes NVMe/TCP one-path-loss now projects honestly through
`SwBlockVolume.status` and all read-only support surfaces:
- healthy RF=2 starts with two paths;
- losing one path produces `blocked/nvme_multipath_path_missing`;
- no volume surface claims `Ready=True`;
- no mutating action is suggested or attempted;
- cleanup is residue-free.
## Non-Claims
This gate does not claim RoCE/NVMe-RDMA, performance/SLO, broad
distro/kernel compatibility, production HA, automatic rebuild, or path
restoration. It proves only the supported-lab Kubernetes NVMe/TCP path-loss
status behavior.
@@ -0,0 +1,331 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT="${1:-$(pwd)}"
ARTIFACT_DIR="${SW_BLOCK_ARTIFACT_DIR:-${ROOT}/results/phase111-nvme-k8s-path-loss-crd-gate}"
SUMMARY="${ARTIFACT_DIR}/phase111-nvme-k8s-path-loss-crd-summary.txt"
HELM_RELEASE="${SW_BLOCK_HELM_RELEASE:-sw-block}"
HELM_NAMESPACE="${SW_BLOCK_HELM_NAMESPACE:-kube-system}"
APP_NAMESPACE="${SW_BLOCK_APP_NAMESPACE:-default}"
IMAGE="${SW_BLOCK_IMAGE:-sw-block:local}"
CSI_IMAGE="${SW_BLOCK_CSI_IMAGE:-sw-block-csi:local}"
STATUS_PORT="${SW_BLOCK_MASTER_PORT_FORWARD_PORT:-29333}"
mkdir -p "${ARTIFACT_DIR}"/{bin,build,values,install,multi-volume,inject,surfaces,cleanup}
: >"${SUMMARY}"
write_summary() {
echo "$*" | tee -a "${SUMMARY}" >/dev/null
}
capture() {
local out="$1"
shift
"$@" >"$out" 2>&1 || true
}
cleanup() {
set +e
helm status "${HELM_RELEASE}" --namespace "${HELM_NAMESPACE}" >/dev/null 2>&1 && \
helm uninstall "${HELM_RELEASE}" --namespace "${HELM_NAMESPACE}" --wait --timeout 240s \
>"${ARTIFACT_DIR}/cleanup/helm-uninstall.txt" 2>&1
kubectl -n "${APP_NAMESPACE}" delete pod -l sw-block-test=multi-volume --ignore-not-found=true --wait=true --timeout=120s >/dev/null 2>&1
kubectl -n "${APP_NAMESPACE}" delete pod sw-block-multi-reader-1 sw-block-multi-writer-1 --ignore-not-found=true --wait=true --timeout=120s >/dev/null 2>&1
kubectl -n "${APP_NAMESPACE}" delete pvc sw-block-multi-pvc-1 --ignore-not-found=true --wait=true --timeout=120s >/dev/null 2>&1
kubectl delete storageclass sw-block-multi --ignore-not-found=true --wait=true --timeout=120s >/dev/null 2>&1
kubectl -n "${APP_NAMESPACE}" delete deploy -l app=sw-blockvolume --ignore-not-found=true --wait=false >/dev/null 2>&1
kubectl -n "${HELM_NAMESPACE}" delete deploy -l app=sw-blockvolume --ignore-not-found=true --wait=false >/dev/null 2>&1
kubectl -n "${HELM_NAMESPACE}" get swblockvolumes.block.seaweedfs.com -o name 2>/dev/null | \
xargs -r -n1 kubectl -n "${HELM_NAMESPACE}" patch --type=merge -p '{"metadata":{"finalizers":[]}}' >/dev/null 2>&1
kubectl -n "${HELM_NAMESPACE}" delete swblockvolumes.block.seaweedfs.com --all --ignore-not-found=true --wait=true --timeout=60s >/dev/null 2>&1
kubectl -n "${HELM_NAMESPACE}" delete swblockclusters.block.seaweedfs.com --all --ignore-not-found=true --wait=true --timeout=60s >/dev/null 2>&1
kubectl delete validatingadmissionpolicy,validatingadmissionpolicybinding -l "app.kubernetes.io/instance=${HELM_RELEASE}" --ignore-not-found=true >/dev/null 2>&1
kubectl delete crd \
swblockclusters.block.seaweedfs.com \
swblockvolumes.block.seaweedfs.com \
swblockreplicaeligibilities.block.seaweedfs.com \
swblockreplicarebuilds.block.seaweedfs.com \
swblockreplicafailbacks.block.seaweedfs.com \
swblockfrontendpublications.block.seaweedfs.com \
--ignore-not-found=true --wait=true --timeout=60s >/dev/null 2>&1
kubectl get pv --no-headers 2>/dev/null | awk '/sw-block-multi/ {print $1}' | \
xargs -r -n1 kubectl patch pv --type=merge -p '{"metadata":{"finalizers":[]}}' >/dev/null 2>&1
kubectl get pv --no-headers 2>/dev/null | awk '/sw-block-multi/ {print $1}' | xargs -r kubectl delete pv --wait=false >/dev/null 2>&1
sudo -n nvme disconnect-all >/dev/null 2>&1 || true
}
trap cleanup EXIT
wait_for_port() {
local port="$1"
for _ in $(seq 1 60); do
if (echo >"/dev/tcp/127.0.0.1/${port}") >/dev/null 2>&1; then
return 0
fi
sleep 1
done
return 1
}
with_master_port_forward() {
local log="$1"
shift
kubectl -n "${HELM_NAMESPACE}" port-forward deploy/sw-blockmaster "${STATUS_PORT}:9333" >"${log}" 2>&1 &
local pf_pid=$!
if ! wait_for_port "${STATUS_PORT}"; then
kill "${pf_pid}" >/dev/null 2>&1 || true
wait "${pf_pid}" >/dev/null 2>&1 || true
return 1
fi
"$@"
local rc=$?
kill "${pf_pid}" >/dev/null 2>&1 || true
wait "${pf_pid}" >/dev/null 2>&1 || true
return "${rc}"
}
python_read_nodes='
from pathlib import Path
base=Path(__import__("sys").argv[1])
nodes=[]
cur=None
for raw in (base/"values/values.nvme.yaml").read_text().splitlines():
line=raw.strip()
if line.startswith("- name:"):
if cur:
nodes.append(cur)
cur={}
if cur is None:
continue
if line.startswith("kubernetesNode:"):
cur["kubernetesNode"]=line.split(":",1)[1].strip().strip("\"")
if cur:
nodes.append(cur)
if len(nodes) < 2:
raise SystemExit("need at least two generated nodes")
(base/"values/blockvolume-node.txt").write_text(nodes[0]["kubernetesNode"]+"\n")
(base/"values/app-node.txt").write_text(nodes[1]["kubernetesNode"]+"\n")
'
wait_for_crd_status() {
local phase="$1"
local want_status="$2"
local want_reason="$3"
local want_path_count="$4"
local out_json="${ARTIFACT_DIR}/surfaces/swblockvolumes.${phase}.json"
for _ in $(seq 1 90); do
kubectl -n "${HELM_NAMESPACE}" get swblockvolumes -o json >"${out_json}" 2>/dev/null || true
python3 - "${out_json}" "${want_status}" "${want_reason}" "${want_path_count}" <<'PY' && return 0 || true
import json, sys
path, want_status, want_reason, want_path_count = sys.argv[1:]
try:
doc=json.load(open(path))
except Exception:
raise SystemExit(1)
items=doc.get("items") or []
if len(items) != 1:
raise SystemExit(1)
st=items[0].get("status") or {}
nv=st.get("nvme") or {}
if st.get("status") != want_status or st.get("reasonCode") != want_reason:
raise SystemExit(1)
if want_path_count != "-" and int(nv.get("pathCount", -1)) != int(want_path_count):
raise SystemExit(1)
conds={c.get("type"): c.get("status") for c in st.get("conditions") or []}
if want_status == "blocked" and conds.get("Ready") == "True":
raise SystemExit(1)
PY
sleep 2
done
echo "SwBlockVolume did not reach ${want_status}/${want_reason}" >&2
kubectl -n "${HELM_NAMESPACE}" get swblockvolumes -o yaml >&2 || true
return 1
}
write_summary "phase111_nvme_k8s_path_loss_crd_status=running"
cleanup
echo "[phase111] build sw-block CLI"
(
cd "${ROOT}"
go build -o "${ARTIFACT_DIR}/bin/sw-block" ./cmd/sw-block
"${ARTIFACT_DIR}/bin/sw-block" ops generate-helm-values \
--kubeconfig /etc/rancher/k3s/k3s.yaml \
--out "${ARTIFACT_DIR}/values/values.nvme.yaml" \
--image "${IMAGE}" \
--csi-image "${CSI_IMAGE}" \
--protocol nvme \
--replication-factor 2 \
--node-limit 2 >"${ARTIFACT_DIR}/values/generate.stdout.txt"
)
cat >>"${ARTIFACT_DIR}/values/values.nvme.yaml" <<'YAML'
operatorStatus:
create: true
dryRun: false
interval: 5s
lifecycleOwner:
create: true
dryRun: false
interval: 5s
YAML
python3 -c "${python_read_nodes}" "${ARTIFACT_DIR}"
grep -q '^network_mode=external-nvme$' "${ARTIFACT_DIR}/values/generate.stdout.txt"
grep -q 'externalNVMe: true' "${ARTIFACT_DIR}/values/values.nvme.yaml"
echo "[phase111] install Helm stack"
(
cd "${ROOT}"
helm lint charts/seaweed-block -f "${ARTIFACT_DIR}/values/values.nvme.yaml" >"${ARTIFACT_DIR}/install/helm-lint.txt"
helm template "${HELM_RELEASE}" charts/seaweed-block --namespace "${HELM_NAMESPACE}" \
-f "${ARTIFACT_DIR}/values/values.nvme.yaml" >"${ARTIFACT_DIR}/install/helm-template.yaml"
grep -q -- '--launcher-external-nvme' "${ARTIFACT_DIR}/install/helm-template.yaml"
grep -q 'sw-block-operator-status' "${ARTIFACT_DIR}/install/helm-template.yaml"
helm install "${HELM_RELEASE}" charts/seaweed-block --namespace "${HELM_NAMESPACE}" --create-namespace \
-f "${ARTIFACT_DIR}/values/values.nvme.yaml" --wait --timeout 10m >"${ARTIFACT_DIR}/install/helm-install.txt"
)
APP_NODE="$(cat "${ARTIFACT_DIR}/values/app-node.txt")"
echo "[phase111] create one RF2 NVMe PVC and verify data path"
(
cd "${ROOT}"
SW_BLOCK_MULTI_VOLUME_NODE_SELECTOR="${APP_NODE}" \
SW_BLOCK_MULTI_VOLUME_PROTOCOL=nvme \
SW_BLOCK_MULTI_VOLUME_RF=2 \
SW_BLOCK_MULTI_VOLUME_COUNT=1 \
SW_BLOCK_MULTI_VOLUME_CLEANUP=0 \
SW_BLOCK_ARTIFACT_DIR="${ARTIFACT_DIR}/multi-volume" \
SW_BLOCK_CLI="${ARTIFACT_DIR}/bin/sw-block" \
bash scripts/run-multi-volume-example.sh "${ROOT}"
)
grep -q '^multi_volume_status=ok$' "${ARTIFACT_DIR}/multi-volume/multi-volume-summary.txt"
grep -q '^writer_verified_count=1$' "${ARTIFACT_DIR}/multi-volume/multi-volume-summary.txt"
grep -q '^reader_verified_count=1$' "${ARTIFACT_DIR}/multi-volume/multi-volume-summary.txt"
wait_for_crd_status "healthy" "ready" "first_volume_verified" "2"
echo "[phase111] scale one blockvolume deployment to zero to remove one NVMe path"
kubectl -n "${APP_NAMESPACE}" get deploy -l app=sw-blockvolume -o json >"${ARTIFACT_DIR}/inject/blockvolume-deployments.before.json"
TARGET_DEPLOY="$(python3 - "${ARTIFACT_DIR}/inject/blockvolume-deployments.before.json" <<'PY'
import json, sys
doc=json.load(open(sys.argv[1]))
items=doc.get("items") or []
if len(items) < 2:
raise SystemExit(f"need at least two blockvolume deployments, got {len(items)}")
items=sorted(items, key=lambda i: i["metadata"]["name"])
print(items[0]["metadata"]["name"])
PY
)"
write_summary "target_deployment=${TARGET_DEPLOY}"
kubectl -n "${APP_NAMESPACE}" scale "deploy/${TARGET_DEPLOY}" --replicas=0 >"${ARTIFACT_DIR}/inject/scale-target.txt"
kubectl -n "${APP_NAMESPACE}" rollout status "deploy/${TARGET_DEPLOY}" --timeout=120s >"${ARTIFACT_DIR}/inject/rollout-target-zero.txt" 2>&1 || true
for _ in $(seq 1 60); do
pods="$(kubectl -n "${APP_NAMESPACE}" get pod -l app=sw-blockvolume -o jsonpath='{range .items[*]}{.metadata.ownerReferences[0].name}{"\n"}{end}' 2>/dev/null | grep -c "^${TARGET_DEPLOY}$" || true)"
[[ "${pods}" == "0" ]] && break
sleep 1
done
kubectl -n "${APP_NAMESPACE}" get deploy,pod -l app=sw-blockvolume -o wide >"${ARTIFACT_DIR}/inject/blockvolume.after-scale.txt"
wait_for_crd_status "pathloss" "blocked" "nvme_multipath_path_missing" "1"
VOLUME_ID="$(python3 - "${ARTIFACT_DIR}/surfaces/swblockvolumes.pathloss.json" <<'PY'
import json, sys
doc=json.load(open(sys.argv[1]))
print(doc["items"][0]["status"]["volumeID"])
PY
)"
write_summary "volume_id=${VOLUME_ID}"
echo "[phase111] collect live surfaces"
with_master_port_forward "${ARTIFACT_DIR}/surfaces/blockmaster-port-forward.log" \
"${ARTIFACT_DIR}/bin/sw-block" ops report \
--master-api "127.0.0.1:${STATUS_PORT}" \
--namespace "${APP_NAMESPACE}" \
--out "${ARTIFACT_DIR}/surfaces/report" \
--timeout 30s >"${ARTIFACT_DIR}/surfaces/report.stdout.txt" 2>"${ARTIFACT_DIR}/surfaces/report.stderr.txt"
"${ARTIFACT_DIR}/bin/sw-block" ops explain volume \
--from-bundle "${ARTIFACT_DIR}/surfaces/report" \
"${VOLUME_ID}" >"${ARTIFACT_DIR}/surfaces/explain.txt" 2>"${ARTIFACT_DIR}/surfaces/explain.stderr.txt"
DASHBOARD_PORT="$(python3 - <<'PY'
import socket
s=socket.socket(); s.bind(("127.0.0.1",0)); print(s.getsockname()[1]); s.close()
PY
)"
"${ARTIFACT_DIR}/bin/sw-block" ops dashboard \
--from-bundle "${ARTIFACT_DIR}/surfaces/report" \
--listen "127.0.0.1:${DASHBOARD_PORT}" >"${ARTIFACT_DIR}/surfaces/dashboard.stdout.txt" 2>"${ARTIFACT_DIR}/surfaces/dashboard.stderr.txt" &
DASH_PID=$!
for _ in $(seq 1 50); do
code="$(curl -s -o "${ARTIFACT_DIR}/surfaces/dashboard-operator-snapshot.json" -w '%{http_code}' "http://127.0.0.1:${DASHBOARD_PORT}/operator-snapshot.json" || true)"
[[ "${code}" == "200" ]] && break
sleep 0.2
done
kill "${DASH_PID}" >/dev/null 2>&1 || true
wait "${DASH_PID}" >/dev/null 2>&1 || true
python3 - "${ARTIFACT_DIR}" <<'PY'
import json, re, sys
from pathlib import Path
base=Path(sys.argv[1])
crd=json.load(open(base/"surfaces/swblockvolumes.pathloss.json"))
item=crd["items"][0]
st=item["status"]
nv=st["nvme"]
volume_id=st["volumeID"]
summary=(base/"surfaces/report/summary.txt").read_text()
snapshot=json.load(open(base/"surfaces/report/operator-snapshot.json"))
dashboard=json.load(open(base/"surfaces/dashboard-operator-snapshot.json"))
explain=(base/"surfaces/explain.txt").read_text()
docs=[("report", snapshot), ("dashboard", dashboard)]
if st.get("status") != "blocked" or st.get("reasonCode") != "nvme_multipath_path_missing":
raise SystemExit(f"crd mismatch: {st}")
if nv.get("pathCount") != 1:
raise SystemExit(f"crd nvme path count mismatch: {nv}")
if any(c.get("type") == "Ready" and c.get("status") == "True" for c in st.get("conditions") or []):
raise SystemExit("CRD contains Ready=True")
if f"managed_volume={volume_id} status=blocked reason=nvme_multipath_path_missing" not in summary:
raise SystemExit("report summary missing blocked/path-missing")
if "Ready=True" in summary:
raise SystemExit("report summary contains Ready=True")
if f"managed_volume_nvme={volume_id}" not in summary or "path_count=1" not in summary:
raise SystemExit("report summary missing nvme path_count=1")
for name, doc in docs:
vols=doc.get("volumes") or []
if len(vols) != 1:
raise SystemExit(f"{name} volume count={len(vols)}")
s=vols[0]["status"]
n=s.get("nvme") or {}
if s.get("status") != "blocked" or s.get("reason_code") != "nvme_multipath_path_missing":
raise SystemExit(f"{name} status mismatch: {s}")
if n.get("path_count") != 1:
raise SystemExit(f"{name} nvme mismatch: {n}")
if any(c.get("type") == "Ready" and c.get("status") == "True" for c in s.get("conditions") or []):
raise SystemExit(f"{name} contains Ready=True")
if "status=blocked reason=nvme_multipath_path_missing" not in explain:
raise SystemExit("explain missing blocked/path-missing")
if "mutation_allowed=false" not in summary and '"mutation_allowed":false' not in json.dumps(snapshot):
raise SystemExit("mutation_allowed=false not surfaced")
(base/"phase111-nvme-k8s-path-loss-crd-asserts.txt").write_text("\n".join([
"phase111_nvme_k8s_path_loss_crd_status=ok",
"before_path_count=2",
"after_path_count=1",
"crd_reason=nvme_multipath_path_missing",
"report_reason=nvme_multipath_path_missing",
"operator_snapshot_reason=nvme_multipath_path_missing",
"dashboard_reason=nvme_multipath_path_missing",
"explain_reason=nvme_multipath_path_missing",
"surface_ready_true_count=0",
"mutation_allowed=false",
])+"\n")
PY
cat "${ARTIFACT_DIR}/phase111-nvme-k8s-path-loss-crd-asserts.txt" >>"${SUMMARY}"
cleanup
(
cd "${ROOT}"
SW_BLOCK_ARTIFACT_DIR="${ARTIFACT_DIR}/cleanup/verify" bash scripts/verify-helm-cleanup.sh "${ROOT}"
)
grep -q '^cleanup_status=ok$' "${ARTIFACT_DIR}/cleanup/verify/cleanup-summary.txt"
write_summary "cleanup_status=ok"
echo "[phase111] PASS"
@@ -0,0 +1,114 @@
name: nvme-tcp-k8s-path-loss-crd-chain
timeout: 50m
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,blockcsi,iscsi-target"
nvme_disconnect: "true"
iscsi_logout_prefix: "iqn.2026-05.io.seaweedfs"
- action: exec
node: m02
timeout: 5m
cmd: "helm status sw-block --namespace kube-system >/dev/null 2>&1 && helm uninstall sw-block --namespace kube-system --wait --timeout 240s || true; kubectl -n default delete pod -l sw-block-test=multi-volume --ignore-not-found=true --wait=true --timeout=120s || true; kubectl -n default delete pod sw-block-multi-reader-1 sw-block-multi-writer-1 --ignore-not-found=true --wait=true --timeout=120s || true; kubectl -n default delete pvc sw-block-multi-pvc-1 --ignore-not-found=true --wait=true --timeout=120s || true; kubectl delete storageclass sw-block-multi --ignore-not-found=true --wait=true --timeout=120s || true; kubectl -n default delete deploy -l app=sw-blockvolume --ignore-not-found=true --wait=false || true; kubectl -n kube-system delete deploy -l app=sw-blockvolume --ignore-not-found=true --wait=false || true; kubectl -n kube-system get swblockvolumes.block.seaweedfs.com -o name 2>/dev/null | xargs -r -n1 kubectl -n kube-system patch --type=merge -p '{\"metadata\":{\"finalizers\":[]}}' >/dev/null 2>&1 || true; kubectl -n kube-system delete swblockvolumes.block.seaweedfs.com --all --ignore-not-found=true --wait=true --timeout=60s || true; kubectl -n kube-system delete swblockclusters.block.seaweedfs.com --all --ignore-not-found=true --wait=true --timeout=60s || true; kubectl delete validatingadmissionpolicy,validatingadmissionpolicybinding -l app.kubernetes.io/instance=sw-block --ignore-not-found=true >/dev/null 2>&1 || true; kubectl delete crd swblockclusters.block.seaweedfs.com swblockvolumes.block.seaweedfs.com swblockreplicaeligibilities.block.seaweedfs.com swblockreplicarebuilds.block.seaweedfs.com swblockreplicafailbacks.block.seaweedfs.com swblockfrontendpublications.block.seaweedfs.com --ignore-not-found=true --wait=true --timeout=60s >/dev/null 2>&1 || true; kubectl get pv --no-headers 2>/dev/null | awk '/sw-block-multi/ {print $1}' | xargs -r -n1 kubectl patch pv --type=merge -p '{\"metadata\":{\"finalizers\":[]}}' >/dev/null 2>&1 || true; kubectl get pv --no-headers 2>/dev/null | awk '/sw-block-multi/ {print $1}' | xargs -r kubectl delete pv --wait=false >/dev/null 2>&1 || true; sudo -n nvme disconnect-all >/dev/null 2>&1 || true; rm -rf /mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase111-nvme-k8s-path-loss-crd && mkdir -p /mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase111-nvme-k8s-path-loss-crd/build /mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase111-nvme-k8s-path-loss-crd/gate"
env.KUBECONFIG: "/etc/rancher/k3s/k3s.yaml"
- name: build_and_import_images
actions:
- action: exec
node: m02
timeout: 10m
cmd: "cd {{ product_root }} && bash scripts/build-alpha-images.sh {{ product_root }}"
env.SW_BLOCK_IMPORT_K3S: "1"
env.SW_BLOCK_IMPORT_K3S_NODES: "192.168.1.181"
env.SW_BLOCK_IMPORT_K3S_SSH_USER: "testdev"
env.SW_BLOCK_IMPORT_K3S_SSH_KEY: "{{ ssh_key }}"
env.SW_BLOCK_DOCKER_NO_CACHE: "1"
env.SW_BLOCK_ARTIFACT_DIR: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase111-nvme-k8s-path-loss-crd/build"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase111-nvme-k8s-path-loss-crd/build/alpha-images.env"
pattern: "SW_BLOCK_IMAGE_ID="
save_as: image_id_count
- action: assert_greater
actual: "{{ image_id_count }}"
threshold: "0"
- name: run_phase111_gate
actions:
- action: exec
node: m02
timeout: 35m
cmd: "cd {{ product_root }} && bash scripts/run-phase111-nvme-k8s-path-loss-crd-gate.sh {{ product_root }}"
env.KUBECONFIG: "/etc/rancher/k3s/k3s.yaml"
env.SW_BLOCK_ARTIFACT_DIR: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase111-nvme-k8s-path-loss-crd/gate"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase111-nvme-k8s-path-loss-crd/gate/phase111-nvme-k8s-path-loss-crd-summary.txt"
pattern: "^phase111_nvme_k8s_path_loss_crd_status=ok$"
save_as: gate_ok
- action: assert_greater
actual: "{{ gate_ok }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase111-nvme-k8s-path-loss-crd/gate/phase111-nvme-k8s-path-loss-crd-summary.txt"
pattern: "^before_path_count=2$"
save_as: before_two_paths
- action: assert_greater
actual: "{{ before_two_paths }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase111-nvme-k8s-path-loss-crd/gate/phase111-nvme-k8s-path-loss-crd-summary.txt"
pattern: "^after_path_count=1$"
save_as: after_one_path
- action: assert_greater
actual: "{{ after_one_path }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase111-nvme-k8s-path-loss-crd/gate/phase111-nvme-k8s-path-loss-crd-summary.txt"
pattern: "^crd_reason=nvme_multipath_path_missing$"
save_as: crd_reason
- action: assert_greater
actual: "{{ crd_reason }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase111-nvme-k8s-path-loss-crd/gate/phase111-nvme-k8s-path-loss-crd-summary.txt"
pattern: "^surface_ready_true_count=0$"
save_as: no_ready_true
- action: assert_greater
actual: "{{ no_ready_true }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase111-nvme-k8s-path-loss-crd/gate/phase111-nvme-k8s-path-loss-crd-summary.txt"
pattern: "^cleanup_status=ok$"
save_as: cleanup_ok
- action: assert_greater
actual: "{{ cleanup_ok }}"
threshold: "0"
- name: collect
always: true
actions:
- action: collect_path
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase111-nvme-k8s-path-loss-crd"
name: "remote-phases"
ignore_error: true