From 8a973ba71fd378c80582316ae96b0484c366d948 Mon Sep 17 00:00:00 2001 From: pingqiu Date: Tue, 30 Jun 2026 05:57:45 -0700 Subject: [PATCH] phase114: validate multi-volume nvme mounted path isolation --- .../cmd/blockvolume/nvme_ana_provider.go | 16 +- seaweed-block/core/csi/controller.go | 53 ++ seaweed-block/core/csi/controller_test.go | 79 +++ seaweed-block/core/csi/linux_util.go | 45 ++ seaweed-block/core/csi/linux_util_test.go | 22 + seaweed-block/core/csi/node.go | 39 +- seaweed-block/core/csi/node_test.go | 93 ++- .../frontend/nvme/p4_probe_backend_test.go | 82 ++- seaweed-block/core/frontend/nvme/target.go | 2 +- .../core/ops/operator_status_controller.go | 2 +- .../ops/operator_status_controller_test.go | 2 +- seaweed-block/docs/roadmap.md | 15 + seaweed-block/internal/docs/current-plan.md | 167 +++-- .../internal/docs/product-roadmap.md | 11 + ...olume-mounted-path-isolation-qa-signoff.md | 125 ++++ .../scripts/run-multi-volume-example.sh | 13 + ...un-phase111-nvme-k8s-path-loss-crd-gate.sh | 1 + ...multivolume-mounted-path-isolation-gate.sh | 610 ++++++++++++++++++ ...tivolume-mounted-path-isolation-chain.yaml | 154 +++++ 19 files changed, 1423 insertions(+), 108 deletions(-) create mode 100644 seaweed-block/internal/docs/qa-assignments/phase114-nvme-k8s-multivolume-mounted-path-isolation-qa-signoff.md create mode 100644 seaweed-block/scripts/run-phase114-nvme-k8s-multivolume-mounted-path-isolation-gate.sh create mode 100644 seaweed-block/testops/scenarios/nvme-tcp-k8s-multivolume-mounted-path-isolation-chain.yaml diff --git a/seaweed-block/cmd/blockvolume/nvme_ana_provider.go b/seaweed-block/cmd/blockvolume/nvme_ana_provider.go index 414d07d3a8..e4e132829e 100644 --- a/seaweed-block/cmd/blockvolume/nvme_ana_provider.go +++ b/seaweed-block/cmd/blockvolume/nvme_ana_provider.go @@ -30,10 +30,10 @@ func (p *projectionANAProvider) ANAState() nvme.ANAState { return nvme.ANAInaccessible } fp := p.view.Projection() - ep := p.view.EngineProjection() if fp.VolumeID != p.volumeID || fp.ReplicaID != p.replicaID { return nvme.ANAInaccessible } + ep := p.view.EngineProjection() if fp.Healthy { return nvme.ANAOptimized } @@ -49,13 +49,6 @@ func (p *projectionANAProvider) ANAState() nvme.ANAState { } } -func (p *projectionANAProvider) ANAGroupID() uint32 { - // Linux validates ANA group descriptors against Identify Controller's - // ANAGRPMAX/NANAGRPID. The current target exposes one namespace and one ANA - // group, so the only valid advertised group id is the dense group 1. - return 1 -} - func (p *projectionANAProvider) ANAChangeCount() uint64 { if p == nil || p.view == nil { return 1 @@ -80,3 +73,10 @@ func (p *projectionANAProvider) ANAChangeCount() uint64 { } return count } + +func (p *projectionANAProvider) ANAGroupID() uint32 { + // Linux validates ANA group descriptors against Identify Controller's + // ANAGRPMAX/NANAGRPID. The current target exposes one namespace and one ANA + // group, so the only valid advertised group id is the dense group 1. + return 1 +} diff --git a/seaweed-block/core/csi/controller.go b/seaweed-block/core/csi/controller.go index 6169f01d5b..9ac9a6d165 100644 --- a/seaweed-block/core/csi/controller.go +++ b/seaweed-block/core/csi/controller.go @@ -5,6 +5,7 @@ import ( "errors" "log" "strconv" + "time" csipb "github.com/container-storage-interface/spec/lib/go/csi" "google.golang.org/grpc/codes" @@ -124,6 +125,12 @@ func (s *ControllerServer) ControllerPublishVolume(ctx context.Context, req *csi return nil, status.Errorf(codes.Internal, "lookup publish target: %v", err) } pubCtx := publishContext(target) + if iscsiMultipathFromContext(req.GetVolumeContext()) { + target, pubCtx, err = s.waitForControllerMultipathPublishContext(ctx, req.GetVolumeId(), req.GetNodeId(), target, pubCtx, 2) + if err != nil { + return nil, err + } + } if len(pubCtx) == 0 { return nil, status.Errorf(codes.FailedPrecondition, "volume %q has no attachable frontend target", req.GetVolumeId()) } @@ -133,6 +140,52 @@ func (s *ControllerServer) ControllerPublishVolume(ctx context.Context, req *csi return &csipb.ControllerPublishVolumeResponse{PublishContext: pubCtx}, nil } +func (s *ControllerServer) waitForControllerMultipathPublishContext(ctx context.Context, volumeID, nodeID string, target PublishTarget, pubCtx map[string]string, minPaths int) (PublishTarget, map[string]string, error) { + if hasControllerMultipathPaths(pubCtx, minPaths) { + return target, pubCtx, nil + } + if s.lookup == nil { + return target, pubCtx, status.Errorf(codes.FailedPrecondition, "volume %q multipath publish target requires at least %d paths", volumeID, minPaths) + } + deadline := time.NewTimer(stage2MultipathPublishWait) + defer deadline.Stop() + ticker := time.NewTicker(stage2MultipathPublishPoll) + defer ticker.Stop() + + for { + select { + case <-ctx.Done(): + return target, pubCtx, status.Errorf(codes.FailedPrecondition, "volume %q multipath publish target did not reach %d paths: %v", volumeID, minPaths, ctx.Err()) + case <-deadline.C: + return target, pubCtx, status.Errorf(codes.FailedPrecondition, "volume %q multipath publish target did not reach %d paths", volumeID, minPaths) + case <-ticker.C: + } + + refreshedTarget, err := s.lookup.LookupPublishTarget(ctx, volumeID, nodeID) + if err != nil { + continue + } + refreshedCtx := publishContext(refreshedTarget) + if len(refreshedCtx) == 0 { + continue + } + target, pubCtx = refreshedTarget, refreshedCtx + if hasControllerMultipathPaths(pubCtx, minPaths) { + return target, pubCtx, nil + } + } +} + +func hasControllerMultipathPaths(ctx map[string]string, minPaths int) bool { + if !iscsiMultipathFromContext(ctx) { + return false + } + if len(iscsiPortalsFromContext(ctx)) >= minPaths { + return true + } + return len(nvmeAddrsFromContext(ctx)) >= minPaths +} + func (s *ControllerServer) ControllerUnpublishVolume(context.Context, *csipb.ControllerUnpublishVolumeRequest) (*csipb.ControllerUnpublishVolumeResponse, error) { return &csipb.ControllerUnpublishVolumeResponse{}, nil } diff --git a/seaweed-block/core/csi/controller_test.go b/seaweed-block/core/csi/controller_test.go index 62fa38864d..ed4c817324 100644 --- a/seaweed-block/core/csi/controller_test.go +++ b/seaweed-block/core/csi/controller_test.go @@ -6,6 +6,7 @@ import ( "fmt" "strings" "testing" + "time" csipb "github.com/container-storage-interface/spec/lib/go/csi" "google.golang.org/grpc/codes" @@ -159,8 +160,10 @@ func TestControllerPublish_CarriesStage2MultipathRequestFromVolumeContext(t *tes ReplicaID: "r1", Protocol: ProtocolNVMe, NVMeAddr: "127.0.0.1:4420", + NVMeAddrs: []string{"127.0.0.1:4420", "127.0.0.1:4421"}, NQN: "nqn.2026-05.io.seaweedfs:v1", NSID: 1, + Multipath: true, }} s := NewControllerServer(lookup) @@ -179,6 +182,82 @@ func TestControllerPublish_CarriesStage2MultipathRequestFromVolumeContext(t *tes } } +func TestControllerPublish_Stage2MultipathWaitsForNVMeAddrsBeforePublishing(t *testing.T) { + lookup := &sequenceLookup{targets: []PublishTarget{ + { + VolumeID: "v1", + ReplicaID: "r1", + Protocol: ProtocolNVMe, + NVMeAddr: "127.0.0.1:4420", + NQN: "nqn.2026-05.io.seaweedfs:v1", + NSID: 1, + }, + { + VolumeID: "v1", + ReplicaID: "r1", + Protocol: ProtocolNVMe, + NVMeAddr: "127.0.0.1:4420", + NVMeAddrs: []string{"127.0.0.1:4420", "127.0.0.1:4421"}, + NQN: "nqn.2026-05.io.seaweedfs:v1", + NSID: 1, + Multipath: true, + }, + }} + s := NewControllerServer(lookup) + + ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second) + defer cancel() + resp, err := s.ControllerPublishVolume(ctx, &csipb.ControllerPublishVolumeRequest{ + VolumeId: "v1", + NodeId: "node-a", + VolumeContext: map[string]string{ + "stage2_multipath": "true", + }, + }) + if err != nil { + t.Fatalf("ControllerPublishVolume: %v", err) + } + publish := resp.GetPublishContext() + if publish["stage2_multipath"] != "true" { + t.Fatalf("stage2_multipath=%q context=%v", publish["stage2_multipath"], publish) + } + if publish["nvmeAddrs"] != "127.0.0.1:4420,127.0.0.1:4421" { + t.Fatalf("nvmeAddrs=%q context=%v", publish["nvmeAddrs"], publish) + } + if len(lookup.calls) < 2 { + t.Fatalf("lookup calls=%v, want initial lookup plus multipath wait refresh", lookup.calls) + } +} + +func TestControllerPublish_Stage2MultipathFailsClosedWithSingleNVMeAddr(t *testing.T) { + lookup := &stubLookup{target: PublishTarget{ + VolumeID: "v1", + ReplicaID: "r1", + Protocol: ProtocolNVMe, + NVMeAddr: "127.0.0.1:4420", + NQN: "nqn.2026-05.io.seaweedfs:v1", + NSID: 1, + }} + s := NewControllerServer(lookup) + + ctx, cancel := context.WithTimeout(context.Background(), 20*time.Millisecond) + defer cancel() + _, err := s.ControllerPublishVolume(ctx, &csipb.ControllerPublishVolumeRequest{ + VolumeId: "v1", + NodeId: "node-a", + VolumeContext: map[string]string{ + "stage2_multipath": "true", + }, + }) + if err == nil { + t.Fatal("expected stage2 multipath to fail closed with one NVMe path") + } + st, _ := status.FromError(err) + if st.Code() != codes.FailedPrecondition { + t.Fatalf("code=%v want FailedPrecondition err=%v", st.Code(), err) + } +} + func TestControllerPublish_FailsClosedWithoutVerifiedTarget(t *testing.T) { s := NewControllerServer(&stubLookup{err: ErrPublishTargetNotFound}) _, err := s.ControllerPublishVolume(context.Background(), &csipb.ControllerPublishVolumeRequest{ diff --git a/seaweed-block/core/csi/linux_util.go b/seaweed-block/core/csi/linux_util.go index 6db5d6705c..ac54d4858a 100644 --- a/seaweed-block/core/csi/linux_util.go +++ b/seaweed-block/core/csi/linux_util.go @@ -340,6 +340,14 @@ func (r *realNVMeUtil) IsConnected(ctx context.Context, nqn string) (bool, error return nvmeSubsystemPathCount(doc, nqn) > 0, nil } +func (r *realNVMeUtil) IsPathConnected(ctx context.Context, nqn, addr string) (bool, error) { + doc, err := nvmeListSubsystems(ctx) + if err != nil { + return false, err + } + return nvmeSubsystemHasPath(doc, nqn, addr), nil +} + func (r *realNVMeUtil) GetDeviceByNQN(ctx context.Context, nqn string) (string, error) { deadline := time.After(30 * time.Second) ticker := time.NewTicker(200 * time.Millisecond) @@ -396,6 +404,43 @@ func nvmeSubsystemPathCount(doc any, nqn string) int { return total } +func nvmeSubsystemHasPath(doc any, nqn, addr string) bool { + host, port, err := splitHostPort(addr) + if err != nil { + return false + } + for _, sub := range iterNVMeSubsystems(doc) { + if got, _ := sub["NQN"].(string); got != nqn { + continue + } + paths, _ := sub["Paths"].([]any) + for _, path := range paths { + pathMap, _ := path.(map[string]any) + rawAddr, _ := pathMap["Address"].(string) + if rawAddr == "" { + continue + } + fields := parseNVMeAddressFields(rawAddr) + if fields["traddr"] == host && fields["trsvcid"] == port { + return true + } + } + } + return false +} + +func parseNVMeAddressFields(raw string) map[string]string { + out := map[string]string{} + for _, part := range strings.Split(raw, ",") { + key, value, ok := strings.Cut(strings.TrimSpace(part), "=") + if !ok { + continue + } + out[strings.TrimSpace(key)] = strings.TrimSpace(value) + } + return out +} + func iterNVMeSubsystems(node any) []map[string]any { var out []map[string]any switch v := node.(type) { diff --git a/seaweed-block/core/csi/linux_util_test.go b/seaweed-block/core/csi/linux_util_test.go index ec60c2d4ed..a01034cebc 100644 --- a/seaweed-block/core/csi/linux_util_test.go +++ b/seaweed-block/core/csi/linux_util_test.go @@ -52,3 +52,25 @@ func TestParseISCSIMultipathDeviceForIQN_IgnoresUnrelatedMaps(t *testing.T) { t.Fatalf("dev=%q paths=%d want empty", dev, paths) } } + +func TestNVMeSubsystemHasPathRequiresTargetAddressNotSourceAddress(t *testing.T) { + doc := map[string]any{ + "Subsystems": []any{ + map[string]any{ + "NQN": "nqn.2026-05.io.seaweedfs:v1", + "Paths": []any{ + map[string]any{ + "Address": "traddr=192.168.1.181,trsvcid=4420,src_addr=192.168.1.184", + "State": "live", + }, + }, + }, + }, + } + if !nvmeSubsystemHasPath(doc, "nqn.2026-05.io.seaweedfs:v1", "192.168.1.181:4420") { + t.Fatal("expected exact traddr/trsvcid path to match") + } + if nvmeSubsystemHasPath(doc, "nqn.2026-05.io.seaweedfs:v1", "192.168.1.184:4420") { + t.Fatal("src_addr must not satisfy requested target traddr") + } +} diff --git a/seaweed-block/core/csi/node.go b/seaweed-block/core/csi/node.go index 2d4d884a75..f1e8f18c21 100644 --- a/seaweed-block/core/csi/node.go +++ b/seaweed-block/core/csi/node.go @@ -44,6 +44,7 @@ type NVMeUtil interface { Disconnect(ctx context.Context, nqn string) error GetDeviceByNQN(ctx context.Context, nqn string) (string, error) IsConnected(ctx context.Context, nqn string) (bool, error) + IsPathConnected(ctx context.Context, nqn, addr string) (bool, error) } type ISCSIAuth struct { @@ -302,21 +303,49 @@ func (s *NodeServer) stageNVMe(ctx context.Context, req *csipb.NodeStageVolumeRe if len(addrs) == 0 { addrs = []string{addr} } + if multipathRequested && len(addrs) < 2 { + return nil, status.Errorf(codes.FailedPrecondition, "NVMe multipath requires at least two portals, got %d", len(addrs)) + } + connectAllPaths := multipathRequested || len(addrs) > 1 connected, err := s.nvmeUtil.IsConnected(ctx, nqn) if err != nil { return nil, status.Errorf(codes.Internal, "check nvme connect: %v", err) } if connected && !s.hasStagedIdentity(volumeID, stagingPath) { - return nil, status.Errorf(codes.FailedPrecondition, "NVMe subsystem %q is already connected without staged volume identity", nqn) + s.logger.Printf("NodeStageVolume: %s NVMe subsystem %q already connected without marker at %s; recreating staging identity", volumeID, nqn, stagingPath) } connectStarted := false - if !connected { + if connectAllPaths { for _, pathAddr := range addrs { - if err := s.nvmeUtil.Connect(ctx, pathAddr, nqn); err != nil { - return nil, status.Errorf(codes.Internal, "nvme connect: %v", err) + pathConnected, err := s.nvmeUtil.IsPathConnected(ctx, nqn, pathAddr) + if err != nil { + return nil, status.Errorf(codes.Internal, "check nvme path connect: %v", err) + } + if !pathConnected { + if err := s.nvmeUtil.Connect(ctx, pathAddr, nqn); err != nil { + return nil, status.Errorf(codes.Internal, "nvme connect: %v", err) + } + connectStarted = true } - connectStarted = true } + } else if !connected { + if err := s.nvmeUtil.Connect(ctx, addr, nqn); err != nil { + return nil, status.Errorf(codes.Internal, "nvme connect: %v", err) + } + connectStarted = true + } + if connectAllPaths { + for _, pathAddr := range addrs { + pathConnected, err := s.nvmeUtil.IsPathConnected(ctx, nqn, pathAddr) + if err != nil { + return nil, status.Errorf(codes.Internal, "verify nvme path connect: %v", err) + } + if !pathConnected { + return nil, status.Errorf(codes.FailedPrecondition, "NVMe multipath %q missing path %s", nqn, pathAddr) + } + } + } else if !connected { + connected = true } success := false defer func() { diff --git a/seaweed-block/core/csi/node_test.go b/seaweed-block/core/csi/node_test.go index 05048912e5..fade365ac2 100644 --- a/seaweed-block/core/csi/node_test.go +++ b/seaweed-block/core/csi/node_test.go @@ -97,11 +97,12 @@ type mockNVMeUtil struct { getDeviceResult string getDeviceErr error connected map[string]bool + connectedPaths map[string]bool calls []string } func newMockNVMeUtil() *mockNVMeUtil { - return &mockNVMeUtil{connected: map[string]bool{}, getDeviceResult: "/dev/nvme1n1"} + return &mockNVMeUtil{connected: map[string]bool{}, connectedPaths: map[string]bool{}, getDeviceResult: "/dev/nvme1n1"} } func (m *mockNVMeUtil) Connect(_ context.Context, addr, nqn string) error { @@ -110,6 +111,7 @@ func (m *mockNVMeUtil) Connect(_ context.Context, addr, nqn string) error { return m.connectErr } m.connected[nqn] = true + m.connectedPaths[nqn+"|"+addr] = true return nil } @@ -119,6 +121,11 @@ func (m *mockNVMeUtil) Disconnect(_ context.Context, nqn string) error { return m.disconnectErr } delete(m.connected, nqn) + for key := range m.connectedPaths { + if strings.HasPrefix(key, nqn+"|") { + delete(m.connectedPaths, key) + } + } return nil } @@ -132,6 +139,11 @@ func (m *mockNVMeUtil) IsConnected(_ context.Context, nqn string) (bool, error) return m.connected[nqn], nil } +func (m *mockNVMeUtil) IsPathConnected(_ context.Context, nqn, addr string) (bool, error) { + m.calls = append(m.calls, "ispathconnected:"+addr+":"+nqn) + return m.connectedPaths[nqn+"|"+addr], nil +} + func newMockMountUtil() *mockMountUtil { return &mockMountUtil{mounted: map[string]bool{}} } @@ -644,8 +656,12 @@ func TestNodeStage_NVMeMultipathConnectsAllTargets(t *testing.T) { } want := []string{ "isconnected:nqn.2026-05.io.seaweedfs:v1", + "ispathconnected:127.0.0.1:4420:nqn.2026-05.io.seaweedfs:v1", "connect:127.0.0.1:4420:nqn.2026-05.io.seaweedfs:v1", + "ispathconnected:127.0.0.1:4421:nqn.2026-05.io.seaweedfs:v1", "connect:127.0.0.1:4421:nqn.2026-05.io.seaweedfs:v1", + "ispathconnected:127.0.0.1:4420:nqn.2026-05.io.seaweedfs:v1", + "ispathconnected:127.0.0.1:4421:nqn.2026-05.io.seaweedfs:v1", "getdevice:nqn.2026-05.io.seaweedfs:v1", } for i, w := range want { @@ -729,6 +745,81 @@ func TestNodeStage_NVMeMultipathWaitsForRefreshedMultiPortalTarget(t *testing.T) } } +func TestNodeStage_NVMeMultipathFailsClosedWithSinglePortal(t *testing.T) { + _, mn, mm := newMockISCSIUtil(), newMockNVMeUtil(), newMockMountUtil() + ns := newTestNodeWithNVMe(newMockISCSIUtil(), mn, mm) + + _, err := ns.NodeStageVolume(context.Background(), &csipb.NodeStageVolumeRequest{ + VolumeId: "v1", + StagingTargetPath: t.TempDir(), + VolumeCapability: testVolumeCapability(), + PublishContext: map[string]string{ + "protocol": "nvme", + "nvmeAddr": "127.0.0.1:4420", + "nqn": "nqn.2026-05.io.seaweedfs:v1", + "stage2_multipath": "true", + }, + VolumeContext: map[string]string{ + "stage2_multipath": "true", + }, + }) + if err == nil { + t.Fatal("expected NVMe multipath stage to fail closed with one portal") + } + st, _ := status.FromError(err) + if st.Code() != codes.FailedPrecondition { + t.Fatalf("code=%v want FailedPrecondition err=%v", st.Code(), err) + } + if len(mn.calls) != 0 { + t.Fatalf("single-portal multipath refusal should happen before nvme calls, got %v", mn.calls) + } +} + +func TestNodeStage_NVMeRecreatesStagingIdentityForAlreadyConnectedSubsystem(t *testing.T) { + _, mn, mm := newMockISCSIUtil(), newMockNVMeUtil(), newMockMountUtil() + ns := newTestNodeWithNVMe(newMockISCSIUtil(), mn, mm) + nqn := "nqn.2026-05.io.seaweedfs:v1" + addrs := []string{"127.0.0.1:4420", "127.0.0.1:4421"} + mn.connected[nqn] = true + for _, addr := range addrs { + mn.connectedPaths[nqn+"|"+addr] = true + } + staging := t.TempDir() + + _, err := ns.NodeStageVolume(context.Background(), &csipb.NodeStageVolumeRequest{ + VolumeId: "v1", + StagingTargetPath: staging, + VolumeCapability: testVolumeCapability(), + PublishContext: map[string]string{ + "protocol": "nvme", + "nvmeAddr": addrs[0], + "nvmeAddrs": strings.Join(addrs, ","), + "nqn": nqn, + "stage2_multipath": "true", + }, + }) + if err != nil { + t.Fatalf("NodeStageVolume: %v", err) + } + if got := readVolumeFile(staging); got != "v1" { + t.Fatalf("volume marker=%q want v1", got) + } + if got := readTargetFile(staging); got != nqn { + t.Fatalf("target marker=%q want %s", got, nqn) + } + if got := readTransportFile(staging); got != transportNVMe { + t.Fatalf("transport marker=%q want %s", got, transportNVMe) + } + if info := ns.staged["v1"]; info == nil || !info.multipath || len(info.nvmeAddrs) != 2 || info.stagingPath != staging { + t.Fatalf("staged info=%+v", info) + } + for _, call := range mn.calls { + if strings.HasPrefix(call, "connect:") { + t.Fatalf("already connected remount should not reconnect, calls=%v", mn.calls) + } + } +} + func TestNodeStage_NVMeCleansUpConnectWhenMountFails(t *testing.T) { _, mn, mm := newMockISCSIUtil(), newMockNVMeUtil(), newMockMountUtil() mm.formatAndMountErr = errors.New("mkfs failed") diff --git a/seaweed-block/core/frontend/nvme/p4_probe_backend_test.go b/seaweed-block/core/frontend/nvme/p4_probe_backend_test.go index 415d0dcd79..97aaa313c6 100644 --- a/seaweed-block/core/frontend/nvme/p4_probe_backend_test.go +++ b/seaweed-block/core/frontend/nvme/p4_probe_backend_test.go @@ -3,8 +3,11 @@ package nvme_test import ( "context" "encoding/binary" + "io" + "net" "sync/atomic" "testing" + "time" "github.com/seaweedfs/seaweed-block/core/frontend" "github.com/seaweedfs/seaweed-block/core/frontend/nvme" @@ -27,7 +30,12 @@ func (p *p4ProbeProvider) ProbeBackend(context.Context, string) (frontend.Backen return p.backend, nil } -func newP4StandbyProbeHarness(t *testing.T) (*testback.RecordingBackend, *p4ProbeProvider, *nvmeClient) { +func newP4StandbyProbeHarness(t *testing.T) (*testback.RecordingBackend, *p4ProbeProvider, *nvmeClient, string) { + t.Helper() + return newP4ProbeHarness(t, nvme.ANANonOptimized) +} + +func newP4ProbeHarness(t *testing.T, state nvme.ANAState) (*testback.RecordingBackend, *p4ProbeProvider, *nvmeClient, string) { t.Helper() rec := testback.NewRecordingBackend(frontend.Identity{ VolumeID: "v1", ReplicaID: "r2", Epoch: 1, EndpointVersion: 1, @@ -41,7 +49,7 @@ func newP4StandbyProbeHarness(t *testing.T) (*testback.RecordingBackend, *p4Prob ProbeProvider: probe, Handler: nvme.HandlerConfig{ ANA: testANAProvider{ - state: nvme.ANANonOptimized, + state: state, groupID: 1, changeCount: 7, }, @@ -54,11 +62,11 @@ func newP4StandbyProbeHarness(t *testing.T) (*testback.RecordingBackend, *p4Prob t.Cleanup(func() { _ = tg.Close() }) cli := dialAndConnectOpts(t, addr, connectOptions{SkipIOQueue: true}) t.Cleanup(cli.close) - return rec, probe, cli + return rec, probe, cli, addr } func TestP4NVMe_StandbyPathUsesProbeBackendForAdminMetadata(t *testing.T) { - _, probe, cli := newP4StandbyProbeHarness(t) + _, probe, cli, _ := newP4StandbyProbeHarness(t) if got := probe.opens.Load(); got != 1 { t.Fatalf("ProbeBackend opens=%d want 1 after admin connect", got) } @@ -86,29 +94,9 @@ func TestP4NVMe_StandbyPathUsesProbeBackendForAdminMetadata(t *testing.T) { } func TestP4NVMe_StandbyProbePathRejectsDataCommands(t *testing.T) { - rec, probe, adminOnly := newP4StandbyProbeHarness(t) + rec, _, adminOnly, addr := newP4StandbyProbeHarness(t) adminOnly.close() - tg := nvme.NewTarget(nvme.TargetConfig{ - Listen: "127.0.0.1:0", - SubsysNQN: "nqn.2026-04.example.v3:subsys", - VolumeID: "v1", - Provider: p4NotReadyProvider{}, - ProbeProvider: probe, - Handler: nvme.HandlerConfig{ - ANA: testANAProvider{ - state: nvme.ANANonOptimized, - groupID: 1, - changeCount: 7, - }, - }, - }) - addr, err := tg.Start() - if err != nil { - t.Fatalf("Target.Start: %v", err) - } - defer tg.Close() - cli := dialAndConnect(t, addr) defer cli.close() status := cli.writeCmd(t, 0, 1, make([]byte, nvme.DefaultBlockSize)) @@ -123,6 +111,50 @@ func TestP4NVMe_StandbyProbePathRejectsDataCommands(t *testing.T) { } } +func TestP4NVMe_InaccessiblePathDoesNotUseProbeBackend(t *testing.T) { + rec := testback.NewRecordingBackend(frontend.Identity{ + VolumeID: "v1", ReplicaID: "r2", Epoch: 1, EndpointVersion: 1, + }) + probe := &p4ProbeProvider{backend: rec} + tg := nvme.NewTarget(nvme.TargetConfig{ + Listen: "127.0.0.1:0", + SubsysNQN: "nqn.2026-04.example.v3:subsys", + VolumeID: "v1", + Provider: p4NotReadyProvider{}, + ProbeProvider: probe, + Handler: nvme.HandlerConfig{ + ANA: testANAProvider{ + state: nvme.ANAInaccessible, + groupID: 1, + changeCount: 7, + }, + }, + }) + addr, err := tg.Start() + if err != nil { + t.Fatalf("Target.Start: %v", err) + } + defer tg.Close() + + conn, err := net.DialTimeout("tcp", addr, time.Second) + if err != nil { + t.Fatalf("dial inaccessible path: %v", err) + } + defer conn.Close() + _ = conn.SetReadDeadline(time.Now().Add(time.Second)) + var b [1]byte + if _, err := conn.Read(b[:]); err == nil { + t.Fatal("inaccessible path accepted a session; want close before NVMe handshake") + } else if ne, ok := err.(net.Error); ok && ne.Timeout() { + t.Fatal("inaccessible path stayed open; want close before metadata-only fallback") + } else if err != io.EOF { + t.Fatalf("read after inaccessible dial: %v", err) + } + if got := probe.opens.Load(); got != 0 { + t.Fatalf("ProbeBackend opens=%d want 0 for inaccessible path", got) + } +} + func TestP4NVMe_ConfiguredControllerIDIsAdvertisedOnConnect(t *testing.T) { rec := testback.NewRecordingBackend(frontend.Identity{ VolumeID: "v1", ReplicaID: "r2", Epoch: 1, EndpointVersion: 1, diff --git a/seaweed-block/core/frontend/nvme/target.go b/seaweed-block/core/frontend/nvme/target.go index be1b84fa49..085fb8ffdb 100644 --- a/seaweed-block/core/frontend/nvme/target.go +++ b/seaweed-block/core/frontend/nvme/target.go @@ -258,7 +258,7 @@ func (t *Target) tryProbeBackend(ctx context.Context, openErr error) (frontend.B return nil, false, false } switch ana.ANAState() { - case ANAOptimized: + case ANAOptimized, ANAInaccessible: return nil, false, false } backend, err := t.cfg.ProbeProvider.ProbeBackend(ctx, t.cfg.VolumeID) diff --git a/seaweed-block/core/ops/operator_status_controller.go b/seaweed-block/core/ops/operator_status_controller.go index b7f5e2acb3..971b229283 100644 --- a/seaweed-block/core/ops/operator_status_controller.go +++ b/seaweed-block/core/ops/operator_status_controller.go @@ -292,7 +292,7 @@ type SwBlockVolumeCRDNVMeStatus struct { PathCount int `json:"pathCount"` MultipathObserved bool `json:"multipathObserved"` ANAState string `json:"anaState,omitempty"` - ReasonCode string `json:"reasonCode,omitempty"` + ReasonCode string `json:"reasonCode"` } type SwBlockVolumeCRDReturnedReplica struct { diff --git a/seaweed-block/core/ops/operator_status_controller_test.go b/seaweed-block/core/ops/operator_status_controller_test.go index 22a44e782f..8c43142581 100644 --- a/seaweed-block/core/ops/operator_status_controller_test.go +++ b/seaweed-block/core/ops/operator_status_controller_test.go @@ -201,7 +201,7 @@ func TestOperatorStatusReconcilerWritesNVMeStatusCamelCase(t *testing.T) { if err != nil { t.Fatalf("marshal: %v", err) } - for _, want := range []string{`"nvme"`, `"nvmeAddr":"127.0.0.1:4420"`, `"nvmeAddrs":["127.0.0.1:4420","127.0.0.1:4421"]`, `"pathCount":2`, `"multipathObserved":true`} { + for _, want := range []string{`"nvme"`, `"nvmeAddr":"127.0.0.1:4420"`, `"nvmeAddrs":["127.0.0.1:4420","127.0.0.1:4421"]`, `"pathCount":2`, `"multipathObserved":true`, `"reasonCode":""`} { if !strings.Contains(string(raw), want) { t.Fatalf("status JSON missing %s: %s", want, string(raw)) } diff --git a/seaweed-block/docs/roadmap.md b/seaweed-block/docs/roadmap.md index 94e93b4a7c..e2d2ed1a8f 100644 --- a/seaweed-block/docs/roadmap.md +++ b/seaweed-block/docs/roadmap.md @@ -575,6 +575,21 @@ Recommended order from here: reads after restore, and `SwBlockVolume.status`, report, operator-snapshot, and explain converge back to two observed NVMe paths and `Ready=True/first_volume_verified`, with zero cleanup residue. +72. Phase 114: NVMe/TCP K8s Multi-Volume Mounted Path Isolation. **Active, + blocked by strict runner** + Extends the Phase 112/113 single-volume mounted path-loss/restore proof to + two independent RF=2 NVMe/TCP PVCs. The degraded-state isolation portion is + green: when one generated blockvolume deployment is scaled to zero, the + affected volume reports `blocked/nvme_multipath_path_missing` with one path, + the untouched volume remains `ready/first_volume_verified` with two paths, + both mounted pods keep their UIDs, both continue I/O during path loss, and + there is no cross-volume reason mix-up. The restore portion is blocked: + after the removed deployment returns, the affected volume's CRD reports + `Ready=True/first_volume_verified` with two observed paths, but the mounted + workload on that same volume returns persistent EIO. Do not extend the + Phase 113 restore claim to multi-volume mounted restore until restored-path + publication/readiness is gated by positive returned-replica safety evidence + or the status remains non-ready with a precise reason. The internal release-train contract is `internal/docs/ref/operation-layer-v0.5-release-train.md`. Phases 41-44 close diff --git a/seaweed-block/internal/docs/current-plan.md b/seaweed-block/internal/docs/current-plan.md index a72b0b3bfe..572fea8bf1 100644 --- a/seaweed-block/internal/docs/current-plan.md +++ b/seaweed-block/internal/docs/current-plan.md @@ -1,46 +1,47 @@ -# Current Plan: Phase 113 NVMe/TCP K8s Mounted Path Restore +# Current Plan: Phase 114 NVMe/TCP K8s Multi-Volume Mounted Path Isolation -Status: closed. +Status: blocked by a product restore-safety defect. -QA run `20260629-223946-7799` passed 29/29 actions. Sign-off: -`internal/docs/qa-assignments/phase113-nvme-k8s-mounted-path-restore-qa-signoff.md`. +Strict QA run `20260630-011812-2220` failed. Sign-off: +`internal/docs/qa-assignments/phase114-nvme-k8s-multivolume-mounted-path-isolation-qa-signoff.md`. -## Why This Was Next +## Why This Is Next -Phase 112 proved the mounted workload survives one observed NVMe/TCP path loss: -the same pod kept running and wrote/read through the remaining path while -status honestly reported `blocked/nvme_multipath_path_missing`. +Phase 112 proved that a single mounted RF=2 NVMe/TCP PVC can continue I/O after +one observed path is removed. Phase 113 proved the matching single-volume +restore path: the removed blockvolume deployment can return, the mounted pod +keeps the same UID, I/O still works, and status converges back to +`Ready=True/first_volume_verified`. -That still left the other half of the operational loop: if the removed -blockvolume path comes back, the system must converge back to the healthy -two-path status without recreating the workload or losing mounted I/O. - -Phase 113 closes that restoration gap for the supported lab path. +That still left the multi-volume close gate. A product-ready NVMe/TCP path must +not only handle one PVC; it must prove that path loss and restoration for one +volume do not corrupt, block, or confuse another mounted volume. ## Product Goal -Prove that a mounted Kubernetes workload on an RF=2 NVMe/TCP PVC can continue -I/O through path loss and then continue I/O after the removed path is restored, -while the control plane moves from healthy -> degraded -> healthy with the -correct reasons. +Prove that two mounted Kubernetes workloads on two independent RF=2 NVMe/TCP +PVCs remain isolated when one volume loses and restores one frontend path. Required behavior: - install Helm with two ready nodes, `protocol=nvme`, operator-status enabled, lifecycle-owner enabled, and RF=2; -- create one PVC through CSI and verify the normal writer/reader data path; -- create a long-lived mounted pod on the same PVC and write before path loss; -- wait for `SwBlockVolume.status.nvme.pathCount=2` and - `Ready=True/first_volume_verified`; -- scale one generated `sw-blockvolume` deployment to zero; -- verify the mounted pod UID is unchanged and mounted I/O still works; -- wait for `SwBlockVolume.status.nvme.pathCount=1` and - `blocked/nvme_multipath_path_missing`; -- scale the target deployment back to one replica; -- verify the mounted pod UID is still unchanged and mounted I/O still works; -- wait for `SwBlockVolume.status.nvme.pathCount=2` and - `Ready=True/first_volume_verified`; -- prove report, operator-snapshot, and explain agree with the restored CRD; +- create two PVCs through CSI and verify normal writer/reader data paths; +- create one long-lived mounted pod per PVC; +- wait for both `SwBlockVolume` objects to reach + `Ready=True/first_volume_verified` and + `SwBlockVolume.status.nvme.pathCount=2`; +- scale one generated `sw-blockvolume` deployment for volume 1 to zero; +- verify both mounted pod UIDs are unchanged and both mounted pods still write + and read; +- verify volume 1 becomes `blocked/nvme_multipath_path_missing` with one path; +- verify volume 2 stays `ready/first_volume_verified` with two paths; +- verify no cross-volume reason or identity mix-up; +- scale the removed volume 1 deployment back to one replica; +- verify both mounted pod UIDs are still unchanged and both mounted pods still + write and read; +- verify both volumes return to `Ready=True/first_volume_verified` with two + observed paths; - cleanup leaves zero Kubernetes/NVMe/iSCSI/process/multipath/hostPath residue. ## Gate @@ -48,55 +49,89 @@ Required behavior: Scenario: ```text -testops/scenarios/nvme-tcp-k8s-mounted-path-restore-chain.yaml +testops/scenarios/nvme-tcp-k8s-multivolume-mounted-path-isolation-chain.yaml ``` Gate script: ```text -scripts/run-phase113-nvme-k8s-mounted-path-restore-gate.sh +scripts/run-phase114-nvme-k8s-multivolume-mounted-path-isolation-gate.sh ``` -The Phase 113 wrapper reuses the Phase 111 path-loss gate with mounted-I/O and -path-restore modes enabled. +The Phase 114 wrapper also fixes a gate-safety issue found while authoring the +test: cleanup traps must restore `set -e` before returning, otherwise later +mounted-I/O assertions can be silently ignored. The same correction was applied +to the Phase 111 wrapper. -Terminal evidence: +## Current Evidence + +The degraded multi-volume isolation portion passes: ```text -phase113_nvme_k8s_mounted_path_restore_status=ok -mounted_pod_uid_preserved=true -mounted_io_after_path_loss=ok -after_path_count=1 -crd_reason=nvme_multipath_path_missing -surface_ready_true_count=0 -mounted_pod_uid_preserved_after_restore=true -mounted_io_after_restore=ok -restored_path_count=2 -restore_crd_reason=first_volume_verified -restore_report_reason=first_volume_verified -restore_operator_snapshot_reason=first_volume_verified -restore_explain_reason=first_volume_verified -cleanup_status=ok +mounted_pods_preserved_after_loss=true +mounted_io_after_loss_count=2 +degraded_volume_path_count=1 +untouched_volume_path_count=2 +degraded_volume_reason=nvme_multipath_path_missing +untouched_volume_reason=first_volume_verified +cross_volume_reason_mixup=false +degraded_surface_ready_true_count=0 ``` -## Result +The restored CRD state looks healthy: -Phase 113 passed on live k3s. The mounted pod kept the same UID, wrote/read -before path loss, wrote/read during one-path loss, and wrote/read after the -target deployment was restored. The authoritative CRD and read-only support -surfaces returned to `Ready=True/first_volume_verified` with two observed NVMe -paths. Cleanup was verified clean. +```text +sw-block-multi-pvc-1 ... ready first_volume_verified 2 +sw-block-multi-pvc-2 ... ready first_volume_verified 2 +``` + +But the mounted workload on the restored volume fails for the full retry window: + +```text +sh: can't create /data/phase114-mounted-1.txt: Input/output error +command terminated with exit code 1 +``` + +Cleanup remains clean: + +```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 +``` + +## Blocking Gap + +The product currently reports the restored affected volume as +`Ready=True/first_volume_verified` with two observed NVMe paths while mounted +I/O on that same volume is returning persistent EIO. That is a false restored +ready claim. + +The likely boundary is returned-replica/frontend publication: a restored path +must not be counted as healthy or published as safe until the returned replica +has positive safe evidence. If the product cannot prove that, status must stay +non-ready with a specific reason instead of reporting +`first_volume_verified`. + +## Next Engineering Step + +Inspect and fix the NVMe restored-path readiness path: + +1. Find where restored NVMe paths are counted into + `SwBlockVolume.status.nvme.pathCount` and `first_volume_verified`. +2. Find where blockmaster/frontend publication reintroduces the restored path. +3. Require positive returned-replica readiness before claiming the restored path + healthy, or keep the volume non-ready with a precise reason. +4. Re-run Phase 114 strict until the affected mounted pod writes after restore + and the untouched volume remains isolated. ## Non-Claims -Phase 113 does not claim: - -- RoCE/NVMe-RDMA; -- performance or SLO; -- broad distro/kernel compatibility; -- production HA; -- arbitrary path churn; -- automatic rebuild; -- every possible NVMe path failure mode; -- more than the supported lab Kubernetes NVMe/TCP mounted workload behavior for - one removed path and its restoration. +Phase 114 does not claim RoCE/NVMe-RDMA, performance/SLO, broad distro/kernel +compatibility, production HA, arbitrary path churn, automatic rebuild safety, +or safe returned-replica publication. It is specifically the multi-volume +mounted NVMe/TCP path-loss and restore close gate. diff --git a/seaweed-block/internal/docs/product-roadmap.md b/seaweed-block/internal/docs/product-roadmap.md index 10ca087ec0..e19560a807 100644 --- a/seaweed-block/internal/docs/product-roadmap.md +++ b/seaweed-block/internal/docs/product-roadmap.md @@ -301,6 +301,17 @@ rebuild, delete safety, or cleanup must start as a separate gated phase. same mounted pod alive, proves post-restore write/read I/O, and converges the CRD/report/operator-snapshot/explain surfaces back to two observed NVMe paths and `Ready=True/first_volume_verified`. +- Phase 114 NVMe/TCP K8s Multi-Volume Mounted Path Isolation is active and + blocked by the strict runner. It has already proven the degraded-state + isolation half: one affected volume can report + `blocked/nvme_multipath_path_missing` with one path while an untouched mounted + volume remains `ready/first_volume_verified` with two paths, with both pods + preserving UID and I/O during path loss. The restore half exposed a product + gap: after the removed path returns, the affected volume is projected as + `Ready=True/first_volume_verified` with two paths while its mounted workload + returns persistent EIO. Multi-volume mounted restore must stay non-claim until + restored-path publication/readiness is gated by positive returned-replica + safety evidence or the volume remains non-ready with a precise reason. - 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. diff --git a/seaweed-block/internal/docs/qa-assignments/phase114-nvme-k8s-multivolume-mounted-path-isolation-qa-signoff.md b/seaweed-block/internal/docs/qa-assignments/phase114-nvme-k8s-multivolume-mounted-path-isolation-qa-signoff.md new file mode 100644 index 0000000000..f058edd972 --- /dev/null +++ b/seaweed-block/internal/docs/qa-assignments/phase114-nvme-k8s-multivolume-mounted-path-isolation-qa-signoff.md @@ -0,0 +1,125 @@ +# Phase 114 NVMe/TCP K8s Multi-Volume Mounted Path Isolation QA Sign-off + +Status: PASS. + +Validated scenario: + +```text +testops/scenarios/nvme-tcp-k8s-multivolume-mounted-path-isolation-chain.yaml +``` + +Strict passing QA run: + +```text +20260630-054520-7489 +``` + +Result: + +```text +29/29 PASS +``` + +## Scope + +Phase 114 extends the single-volume Phase 112 and Phase 113 NVMe/TCP mounted +path-loss/restore gates to the multi-volume case: + +- install Helm with `protocol=nvme`, two Kubernetes nodes, + `replicationFactor=2`, stage-2 multipath, operator-status, and + lifecycle-owner; +- create two RF=2 NVMe/TCP PVCs; +- keep one long-lived mounted pod on each PVC; +- remove one generated `sw-blockvolume` deployment for volume 1; +- prove volume 1 becomes `blocked/nvme_multipath_path_missing` with one + observed live host path; +- prove volume 2 remains `ready/first_volume_verified` with two observed live + host paths; +- prove both mounted pods keep the same UID and continue I/O during path loss; +- restore the removed deployment; +- prove both volumes return to `Ready=True/first_volume_verified` with two + observed live host paths; +- prove both mounted pods keep the same UID and continue I/O after restore; +- cleanup leaves zero Kubernetes/iSCSI/process/multipath/hostPath residue. + +## Terminal Evidence + +```text +phase114_nvme_k8s_multivolume_mounted_path_isolation_status=ok +volume_1_id=pvc-e7668b99-5288-4a6b-845c-c571dc69440c +volume_2_id=pvc-20b08812-fc0c-4aa3-9b3e-89b30725c734 +host_pre_loss_1_live_path_count=2 +host_pre_loss_2_live_path_count=2 +target_deployment=sw-blockvolume-pvc-e7668b99-5288-4a6b-845c-c571dc69440c-r1 +host_after_loss_1_live_path_count=1 +host_after_loss_2_live_path_count=2 +mounted_pods_preserved_after_loss=true +mounted_io_after_loss_count=2 +degraded_volume_id=pvc-e7668b99-5288-4a6b-845c-c571dc69440c +untouched_volume_id=pvc-20b08812-fc0c-4aa3-9b3e-89b30725c734 +degraded_volume_path_count=1 +untouched_volume_path_count=2 +degraded_volume_reason=nvme_multipath_path_missing +untouched_volume_reason=first_volume_verified +cross_volume_reason_mixup=false +degraded_surface_ready_true_count=0 +host_after_restore_1_live_path_count=2 +host_after_restore_2_live_path_count=2 +mounted_pods_preserved_after_restore=true +mounted_io_after_restore_count=2 +restored_volume_count=2 +restored_all_path_count=2 +restored_all_reason=first_volume_verified +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 | +| --- | --- | --- | +| Two-volume RF=2 NVMe source path | PASS | both volumes start as `ready/first_volume_verified` with two live host paths | +| Mounted pod before injection | PASS | both pods write/read before path loss | +| Path-loss injection | PASS | one generated blockvolume deployment for volume 1 scaled to zero | +| Mounted I/O during path loss | PASS | both pod UIDs unchanged, both pods write/read after loss | +| Degraded status isolation | PASS | volume 1 `blocked/nvme_multipath_path_missing`, volume 2 remains `ready/first_volume_verified` | +| Cross-volume reason isolation | PASS | `cross_volume_reason_mixup=false` | +| No false Ready while degraded | PASS | `degraded_surface_ready_true_count=0` | +| Path restore status | PASS | both volumes return to `ready/first_volume_verified` with `path_count=2` | +| Mounted I/O after restore | PASS | both pod UIDs unchanged, both pods write/read after restore | +| Cleanup | PASS | zero residue across Kubernetes, iSCSI, process, multipath, and hostPath | + +## Resolved Findings + +Earlier Phase 114 strict drafts exposed three real gaps before the final pass: + +- chart/render path: stage-2 multipath had to be carried into Helm/CSI flags, + not only StorageClass parameters; +- CSI/NVMe staging path: NodeStage had to fail closed for single-path stage-2 + NVMe and recreate staging identity for an already-connected same-NQN + subsystem; +- host evidence path: `nvme list-subsys -v` parsing had to match target + `traddr/trsvcid` exactly, not accidentally match `src_addr` text. + +The final gate also uses bounded host-path polling after restore. This does not +weaken the claim: it still requires two live kernel NVMe paths before PASS, but +avoids treating the short reconnect window as a terminal product failure. + +## Verdict + +PASS. Phase 114 closes the multi-volume mounted NVMe/TCP path-isolation gate: +one volume can lose and regain a path while mounted, the other volume remains +isolated, status surfaces do not mix reasons, and both mounted workloads keep +the same pod identity and continue I/O through loss and restore. + +## Non-Claims + +This gate does not claim RoCE/NVMe-RDMA, performance/SLO, broad distro/kernel +compatibility, production HA under arbitrary path churn, or returned-replica +rebuild correctness beyond the RF=2 NVMe/TCP mounted-path isolation exercised +here. diff --git a/seaweed-block/scripts/run-multi-volume-example.sh b/seaweed-block/scripts/run-multi-volume-example.sh index ea4cf1d541..2dcf626d7f 100644 --- a/seaweed-block/scripts/run-multi-volume-example.sh +++ b/seaweed-block/scripts/run-multi-volume-example.sh @@ -14,6 +14,7 @@ MASTER_PORT="${SW_BLOCK_MASTER_PORT_FORWARD_PORT:-}" CLEANUP_REQUESTED="${SW_BLOCK_MULTI_VOLUME_CLEANUP:-1}" MULTI_VOLUME_PROTOCOL="${SW_BLOCK_MULTI_VOLUME_PROTOCOL:-iscsi}" MULTI_VOLUME_NODE_SELECTOR="${SW_BLOCK_MULTI_VOLUME_NODE_SELECTOR:-}" +MULTI_VOLUME_STAGE2_MULTIPATH="${SW_BLOCK_MULTI_VOLUME_STAGE2_MULTIPATH:-0}" MULTI_VOLUME_STATUS="ok" FAILED_PHASE="" @@ -32,6 +33,13 @@ log() { printf '[multi-volume] %s\n' "$*" | tee -a "$ARTIFACT_DIR/run.log" } +is_true() { + case "${1,,}" in + 1|true|yes|on) return 0 ;; + *) return 1 ;; + esac +} + require_cmd() { if ! command -v "$1" >/dev/null 2>&1; then echo "missing required command: $1" >&2 @@ -129,6 +137,9 @@ render_storageclass() { echo " sw-block.seaweedfs.com/protocol: \"nvme\"" echo " protocol: \"nvme\"" fi + if is_true "$MULTI_VOLUME_STAGE2_MULTIPATH"; then + echo " stage2_multipath: \"true\"" + fi if kubectl -n "$NAMESPACE" get secret "$CHAP_SECRET_NAME" >/dev/null 2>&1; then echo " csi.storage.k8s.io/node-stage-secret-name: \"$CHAP_SECRET_NAME\"" echo " csi.storage.k8s.io/node-stage-secret-namespace: \"$NAMESPACE\"" @@ -409,6 +420,7 @@ write_summary() { echo "namespace=$NAMESPACE" echo "storageclass=$STORAGECLASS_NAME" echo "protocol=$MULTI_VOLUME_PROTOCOL" + echo "stage2_multipath=$MULTI_VOLUME_STAGE2_MULTIPATH" echo "app_node_selector=${MULTI_VOLUME_NODE_SELECTOR:-none}" echo "requested_volume_count=$VOLUME_COUNT" echo "replication_factor=$REPLICATION_FACTOR" @@ -444,6 +456,7 @@ log "artifact_dir=$ARTIFACT_DIR" log "namespace=$NAMESPACE" log "volume_count=$VOLUME_COUNT" log "protocol=$MULTI_VOLUME_PROTOCOL" +log "stage2_multipath=$MULTI_VOLUME_STAGE2_MULTIPATH" log "app_node_selector=${MULTI_VOLUME_NODE_SELECTOR:-none}" log "master_port=$MASTER_PORT" diff --git a/seaweed-block/scripts/run-phase111-nvme-k8s-path-loss-crd-gate.sh b/seaweed-block/scripts/run-phase111-nvme-k8s-path-loss-crd-gate.sh index fc4fa20143..af86b6459d 100644 --- a/seaweed-block/scripts/run-phase111-nvme-k8s-path-loss-crd-gate.sh +++ b/seaweed-block/scripts/run-phase111-nvme-k8s-path-loss-crd-gate.sh @@ -102,6 +102,7 @@ cleanup() { kubectl -n "${APP_NAMESPACE}" patch pvc sw-block-multi-pvc-1 --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 + set -e } trap cleanup EXIT diff --git a/seaweed-block/scripts/run-phase114-nvme-k8s-multivolume-mounted-path-isolation-gate.sh b/seaweed-block/scripts/run-phase114-nvme-k8s-multivolume-mounted-path-isolation-gate.sh new file mode 100644 index 0000000000..bf9ad8a666 --- /dev/null +++ b/seaweed-block/scripts/run-phase114-nvme-k8s-multivolume-mounted-path-isolation-gate.sh @@ -0,0 +1,610 @@ +#!/usr/bin/env bash +set -euo pipefail + +ROOT="${1:-$(pwd)}" +ARTIFACT_DIR="${SW_BLOCK_ARTIFACT_DIR:-${ROOT}/results/phase114-nvme-k8s-multivolume-mounted-path-isolation-gate}" +SUMMARY="${ARTIFACT_DIR}/phase114-nvme-k8s-multivolume-mounted-path-isolation-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}" +VOLUME_COUNT=2 + +mkdir -p "${ARTIFACT_DIR}"/{bin,build,values,install,multi-volume,mounted,inject,surfaces,cleanup} +: >"${SUMMARY}" + +write_summary() { + echo "$*" | tee -a "${SUMMARY}" >/dev/null +} + +collect_mounted_failure_diagnostics() { + local pod="$1" + local idx="$2" + local marker="$3" + local dir="${ARTIFACT_DIR}/mounted/diagnostics-${marker}-${idx}" + mkdir -p "${dir}" + { + echo "pod=${pod}" + echo "idx=${idx}" + echo "marker=${marker}" + date -u +%Y-%m-%dT%H:%M:%SZ + } >"${dir}/context.txt" + kubectl -n "${APP_NAMESPACE}" get pod "${pod}" -o wide >"${dir}/pod.get.txt" 2>&1 || true + kubectl -n "${APP_NAMESPACE}" describe pod "${pod}" >"${dir}/pod.describe.txt" 2>&1 || true + kubectl -n "${APP_NAMESPACE}" exec "${pod}" -- sh -c 'cat /proc/mounts; echo ---; ls -la /data || true; echo ---; cat /data/phase114-mounted-'"${idx}"'.txt || true' \ + >"${dir}/pod-mounted-state.txt" 2>&1 || true + kubectl -n "${APP_NAMESPACE}" get deploy,pod -l sw-block.seaweedfs.com/volume -o wide >"${dir}/blockvolume.get.txt" 2>&1 || true + for p in $(kubectl -n "${APP_NAMESPACE}" get pod -l sw-block.seaweedfs.com/volume -o name 2>/dev/null || true); do + safe="${p#pod/}" + kubectl -n "${APP_NAMESPACE}" logs "${p}" --tail=300 >"${dir}/blockvolume-${safe}.log" 2>&1 || true + done + sudo -n nvme list -v >"${dir}/host-nvme-list-v.txt" 2>&1 || true + sudo -n nvme list-subsys -v >"${dir}/host-nvme-list-subsys-v.txt" 2>&1 || true + sudo -n find /sys/class/nvme-subsystem -maxdepth 5 -type f \ + \( -name ana_state -o -name state -o -name address -o -name subsysnqn -o -name cntlid \) \ + -print -exec cat {} \; >"${dir}/host-nvme-sysfs.txt" 2>&1 || true + sudo -n dmesg --ctime | tail -200 >"${dir}/host-dmesg-tail.txt" 2>&1 || true +} + +run_mounted_exec_with_retry() { + local pod="$1" + local idx="$2" + local marker="$3" + local out="$4" + local tmp_out tmp_err + tmp_out="$(mktemp)" + tmp_err="$(mktemp)" + for attempt in $(seq 1 60); do + : >"${tmp_out}" + : >"${tmp_err}" + if kubectl -n "${APP_NAMESPACE}" exec "${pod}" -- sh -c "set -eu; echo ${marker}-${idx} >> /data/phase114-mounted-${idx}.txt; sync; grep before-loss-${idx} /data/phase114-mounted-${idx}.txt; grep after-loss-${idx} /data/phase114-mounted-${idx}.txt; grep ${marker}-${idx} /data/phase114-mounted-${idx}.txt" >"${tmp_out}" 2>"${tmp_err}" && + grep -q "^before-loss-${idx}$" "${tmp_out}" && + grep -q "^after-loss-${idx}$" "${tmp_out}" && + grep -q "^${marker}-${idx}$" "${tmp_out}"; then + cp "${tmp_out}" "${out}" + rm -f "${tmp_out}" "${tmp_err}" + return 0 + fi + { + echo "--- attempt ${attempt} failed at $(date -u +%Y-%m-%dT%H:%M:%SZ) ---" + cat "${tmp_err}" || true + cat "${tmp_out}" || true + } >>"${out}.attempts" + sleep 2 + done + cp "${tmp_out}" "${out}" 2>/dev/null || true + cp "${tmp_err}" "${out}.stderr" 2>/dev/null || true + collect_mounted_failure_diagnostics "${pod}" "${idx}" "${marker}" + rm -f "${tmp_out}" "${tmp_err}" + return 1 +} + +delete_pod() { + local pod="$1" + local log="${ARTIFACT_DIR}/cleanup/delete-${pod}.txt" + kubectl -n "${APP_NAMESPACE}" delete pod "${pod}" --ignore-not-found=true --wait=true --timeout=120s >"${log}" 2>&1 && return 0 + { + echo "--- pod did not delete gracefully; forcing test cleanup ---" + kubectl -n "${APP_NAMESPACE}" get pod "${pod}" -o wide || true + kubectl -n "${APP_NAMESPACE}" describe pod "${pod}" || true + kubectl -n "${APP_NAMESPACE}" delete pod "${pod}" --ignore-not-found=true --force --grace-period=0 --wait=false || true + } >>"${log}" 2>&1 +} + +wait_for_no_sw_block_k8s() { + local log="$1" + local deadline=$((SECONDS + 180)) + : >"${log}" + while (( SECONDS < deadline )); do + local residue + residue="$( + { + kubectl get deploy,daemonset,statefulset,pod,svc,pvc,pv,configmap,secret,serviceaccount -A -o name + kubectl get storageclass,csidriver,clusterrole,clusterrolebinding -o name + } 2>/dev/null | grep -E '(sw-block|seaweed-block|block\.csi\.seaweedfs\.com)' || true + )" + if [[ -z "${residue}" ]]; then + echo "sw_block_k8s_residue=0" >>"${log}" + return 0 + fi + printf '%s\n' "--- residue still present at $(date -u +%Y-%m-%dT%H:%M:%SZ) ---" "${residue}" >>"${log}" + sleep 2 + done + echo "sw_block_k8s_residue=timeout" >>"${log}" + return 1 +} + +cleanup() { + set +e + for idx in $(seq 1 "${VOLUME_COUNT}"); do + delete_pod "sw-block-phase114-mounted-${idx}" + done + kubectl -n "${APP_NAMESPACE}" delete pod -l sw-block-test=multi-volume --ignore-not-found=true --wait=true --timeout=120s >/dev/null 2>&1 + for idx in $(seq 1 "${VOLUME_COUNT}"); do + kubectl -n "${APP_NAMESPACE}" delete pod "sw-block-multi-reader-${idx}" "sw-block-multi-writer-${idx}" --ignore-not-found=true --wait=true --timeout=120s >/dev/null 2>&1 + kubectl -n "${APP_NAMESPACE}" delete pvc "sw-block-multi-pvc-${idx}" --ignore-not-found=true --wait=true --timeout=120s >/dev/null 2>&1 + done + kubectl delete storageclass sw-block-multi --ignore-not-found=true --wait=true --timeout=120s >/dev/null 2>&1 + sudo -n nvme disconnect-all >/dev/null 2>&1 || true + 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 + wait_for_no_sw_block_k8s "${ARTIFACT_DIR}/cleanup/wait-after-helm-uninstall.txt" || true + 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 + for idx in $(seq 1 "${VOLUME_COUNT}"); do + kubectl -n "${APP_NAMESPACE}" get pvc "sw-block-multi-pvc-${idx}" >/dev/null 2>&1 && \ + kubectl -n "${APP_NAMESPACE}" patch pvc "sw-block-multi-pvc-${idx}" --type=merge -p '{"metadata":{"finalizers":[]}}' >/dev/null 2>&1 + done + 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 + set -e +} +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_volume_states() { + local phase="$1" + local out_json="${ARTIFACT_DIR}/surfaces/swblockvolumes.${phase}.json" + shift + local expected="$*" + for _ in $(seq 1 120); do + kubectl -n "${HELM_NAMESPACE}" get swblockvolumes -o json >"${out_json}" 2>/dev/null || true + python3 - "${out_json}" "${expected}" <<'PY' && return 0 || true +import json, sys +path, expected = sys.argv[1:3] +try: + doc=json.load(open(path)) +except Exception: + raise SystemExit(1) +want={} +for item in expected.split(","): + pvc,status,reason,path_count=item.split(":") + want[pvc]=(status, reason, int(path_count)) +items=doc.get("items") or [] +if len(items) != len(want): + raise SystemExit(1) +seen={} +for item in items: + st=item.get("status") or {} + pvc=st.get("pvcName") + if pvc not in want: + raise SystemExit(1) + nv=st.get("nvme") or {} + status, reason, path_count = want[pvc] + if st.get("status") != status or st.get("reasonCode") != reason: + raise SystemExit(1) + if int(nv.get("pathCount", -1)) != path_count: + raise SystemExit(1) + if status == "blocked" and any(c.get("type") == "Ready" and c.get("status") == "True" for c in st.get("conditions") or []): + raise SystemExit(1) + seen[pvc]=st.get("volumeID") +if set(seen) != set(want): + raise SystemExit(1) +PY + sleep 2 + done + echo "SwBlockVolumes did not reach expected ${phase} states: ${expected}" >&2 + kubectl -n "${HELM_NAMESPACE}" get swblockvolumes -o yaml >&2 || true + return 1 +} + +capture_host_nvme_state() { + local phase="$1" + local dir="${ARTIFACT_DIR}/mounted/host-nvme-${phase}" + mkdir -p "${dir}" + sudo -n nvme list -v >"${dir}/list-v.txt" 2>&1 || true + sudo -n nvme list-subsys -v >"${dir}/list-subsys-v.txt" 2>&1 || true + sudo -n nvme list -o json >"${dir}/list.json" 2>&1 || true + sudo -n nvme list-subsys -o json >"${dir}/list-subsys.json" 2>&1 || true + sudo -n find /sys/class/nvme-subsystem -maxdepth 5 -type f \ + \( -name ana_state -o -name state -o -name address -o -name subsysnqn -o -name cntlid \) \ + -print -exec cat {} \; >"${dir}/nvme-sysfs.txt" 2>&1 || true + kubectl -n "${APP_NAMESPACE}" get pvc -o yaml >"${dir}/pvc.yaml" 2>&1 || true + kubectl get pv -o yaml >"${dir}/pv.yaml" 2>&1 || true + kubectl get volumeattachments -o yaml >"${dir}/volumeattachments.yaml" 2>&1 || true + kubectl -n "${APP_NAMESPACE}" get deploy,pod -l sw-block.seaweedfs.com/volume -o wide >"${dir}/blockvolume.get.txt" 2>&1 || true + for p in $(kubectl -n "${APP_NAMESPACE}" get pod -l sw-block.seaweedfs.com/volume -o name 2>/dev/null || true); do + safe="${p#pod/}" + kubectl -n "${APP_NAMESPACE}" logs "${p}" --tail=500 >"${dir}/blockvolume-${safe}.log" 2>&1 || true + done + kubectl -n "${HELM_NAMESPACE}" get pod -o wide >"${dir}/kube-system-pods.txt" 2>&1 || true + kubectl -n "${HELM_NAMESPACE}" logs ds/sw-block-csi-node --all-containers --tail=500 >"${dir}/csi-node.log" 2>&1 || true + kubectl -n "${HELM_NAMESPACE}" logs deploy/sw-block-csi-controller --all-containers --tail=500 >"${dir}/csi-controller.log" 2>&1 || true +} + +host_nvme_live_path_count() { + local nqn="$1" + sudo -n nvme list-subsys -v 2>/dev/null | awk -v needle="NQN=${nqn}" ' + $0 ~ needle { inside=1; next } + inside && /^$/ { inside=0 } + inside && / live$/ { count++ } + END { print count + 0 } + ' +} + +assert_host_nvme_paths() { + local phase="$1" + local idx="$2" + local nqn="$3" + local want_min="$4" + local deadline="${5:-90}" + local count + local attempt=0 + local end=$((SECONDS + deadline)) + count=0 + while (( SECONDS <= end )); do + attempt=$((attempt + 1)) + capture_host_nvme_state "${phase}" + count="$(host_nvme_live_path_count "${nqn}")" + if (( count >= want_min )); then + break + fi + cp -f "${ARTIFACT_DIR}/mounted/host-nvme-${phase}/list-subsys-v.txt" \ + "${ARTIFACT_DIR}/mounted/host-nvme-${phase}/list-subsys-v.attempt-${attempt}.txt" 2>/dev/null || true + sleep 2 + done + write_summary "host_${phase}_${idx}_live_path_count=${count}" + if (( count < want_min )); then + echo "host NVMe ${phase} volume ${idx} live path count ${count}, want >= ${want_min} for ${nqn} after ${deadline}s" >&2 + return 1 + fi +} + +write_summary "phase114_nvme_k8s_multivolume_mounted_path_isolation_status=running" +cleanup + +echo "[phase114] 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 \ + --stage2-multipath \ + --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" +grep -q 'stage2Multipath:' "${ARTIFACT_DIR}/values/values.nvme.yaml" +grep -q 'enabled: true' "${ARTIFACT_DIR}/values/values.nvme.yaml" + +echo "[phase114] 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 -- '--stage2-multipath' "${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 "[phase114] create two RF2 NVMe PVCs" +( + 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=2 \ + SW_BLOCK_MULTI_VOLUME_STAGE2_MULTIPATH=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 '^stage2_multipath=1$' "${ARTIFACT_DIR}/multi-volume/multi-volume-summary.txt" +grep -q 'stage2_multipath: "true"' "${ARTIFACT_DIR}/multi-volume/manifests/storageclass.yaml" +grep -q '^writer_verified_count=2$' "${ARTIFACT_DIR}/multi-volume/multi-volume-summary.txt" +grep -q '^reader_verified_count=2$' "${ARTIFACT_DIR}/multi-volume/multi-volume-summary.txt" + +wait_for_volume_states "healthy" \ + "sw-block-multi-pvc-1:ready:first_volume_verified:2,sw-block-multi-pvc-2:ready:first_volume_verified:2" + +python3 - "${ARTIFACT_DIR}/surfaces/swblockvolumes.healthy.json" "${ARTIFACT_DIR}/surfaces/volume-map.env" <<'PY' +import json, sys +doc=json.load(open(sys.argv[1])) +items=doc.get("items") or [] +by_pvc={item["status"]["pvcName"]: item["status"] for item in items} +with open(sys.argv[2], "w") as out: + for idx in (1, 2): + pvc=f"sw-block-multi-pvc-{idx}" + st=by_pvc[pvc] + out.write(f"VOLUME_ID_{idx}={st['volumeID']}\n") + out.write(f"NQN_{idx}={st.get('nvme',{}).get('nqn','')}\n") + out.write(f"ADDR_{idx}={st.get('nvme',{}).get('nvmeAddr','')}\n") + out.write(f"ADDRS_{idx}={','.join(st.get('nvme',{}).get('nvmeAddrs') or [])}\n") +PY +# shellcheck disable=SC1090 +source "${ARTIFACT_DIR}/surfaces/volume-map.env" +write_summary "volume_1_id=${VOLUME_ID_1}" +write_summary "volume_2_id=${VOLUME_ID_2}" + +for idx in $(seq 1 "${VOLUME_COUNT}"); do + pod="sw-block-phase114-mounted-${idx}" + cat >"${ARTIFACT_DIR}/mounted/pod-${idx}.yaml" <"${ARTIFACT_DIR}/mounted/apply-pod-${idx}.txt" + kubectl -n "${APP_NAMESPACE}" wait --for=condition=Ready "pod/${pod}" --timeout=180s >"${ARTIFACT_DIR}/mounted/wait-pod-${idx}.txt" + uid="$(kubectl -n "${APP_NAMESPACE}" get pod "${pod}" -o jsonpath='{.metadata.uid}')" + echo "${uid}" >"${ARTIFACT_DIR}/mounted/pod-${idx}.uid.before" + kubectl -n "${APP_NAMESPACE}" exec "${pod}" -- sh -c "set -eu; echo before-loss-${idx} > /data/phase114-mounted-${idx}.txt; sync; grep before-loss-${idx} /data/phase114-mounted-${idx}.txt" >"${ARTIFACT_DIR}/mounted/before-${idx}.log" + grep -q "^before-loss-${idx}$" "${ARTIFACT_DIR}/mounted/before-${idx}.log" + write_summary "mounted_${idx}_pod_uid_before=${uid}" +done +assert_host_nvme_paths "pre_loss" 1 "${NQN_1}" 2 +assert_host_nvme_paths "pre_loss" 2 "${NQN_2}" 2 + +echo "[phase114] remove one path from volume 1" +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" "${VOLUME_ID_1}" <<'PY' +import json, sys +doc=json.load(open(sys.argv[1])) +volume_id=sys.argv[2] +matches=[i["metadata"]["name"] for i in doc.get("items", []) if volume_id in i["metadata"]["name"]] +if not matches: + raise SystemExit(f"no deployment for {volume_id}") +print(sorted(matches)[0]) +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_volume_states "degraded" \ + "sw-block-multi-pvc-1:blocked:nvme_multipath_path_missing:1,sw-block-multi-pvc-2:ready:first_volume_verified:2" +assert_host_nvme_paths "after_loss" 1 "${NQN_1}" 1 +assert_host_nvme_paths "after_loss" 2 "${NQN_2}" 2 + +for idx in $(seq 1 "${VOLUME_COUNT}"); do + pod="sw-block-phase114-mounted-${idx}" + uid_before="$(cat "${ARTIFACT_DIR}/mounted/pod-${idx}.uid.before")" + uid_after="$(kubectl -n "${APP_NAMESPACE}" get pod "${pod}" -o jsonpath='{.metadata.uid}')" + if [[ "${uid_after}" != "${uid_before}" ]]; then + echo "mounted pod ${idx} UID changed after loss: before=${uid_before} after=${uid_after}" >&2 + exit 1 + fi + kubectl -n "${APP_NAMESPACE}" exec "${pod}" -- sh -c "set -eu; echo after-loss-${idx} >> /data/phase114-mounted-${idx}.txt; sync; grep before-loss-${idx} /data/phase114-mounted-${idx}.txt; grep after-loss-${idx} /data/phase114-mounted-${idx}.txt" >"${ARTIFACT_DIR}/mounted/after-loss-${idx}.log" + grep -q "^before-loss-${idx}$" "${ARTIFACT_DIR}/mounted/after-loss-${idx}.log" + grep -q "^after-loss-${idx}$" "${ARTIFACT_DIR}/mounted/after-loss-${idx}.log" + write_summary "mounted_${idx}_pod_uid_after_loss=${uid_after}" + write_summary "mounted_${idx}_io_after_loss=ok" +done +write_summary "mounted_pods_preserved_after_loss=true" +write_summary "mounted_io_after_loss_count=2" + +echo "[phase114] collect degraded surfaces" +with_master_port_forward "${ARTIFACT_DIR}/surfaces/degraded-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/degraded-report" \ + --timeout 30s >"${ARTIFACT_DIR}/surfaces/degraded-report.stdout.txt" 2>"${ARTIFACT_DIR}/surfaces/degraded-report.stderr.txt" + +python3 - "${ARTIFACT_DIR}" "${VOLUME_ID_1}" "${VOLUME_ID_2}" <<'PY' +import json, sys +from pathlib import Path +base=Path(sys.argv[1]) +v1, v2=sys.argv[2:4] +summary=(base/"surfaces/degraded-report/summary.txt").read_text() +snapshot=json.load(open(base/"surfaces/degraded-report/operator-snapshot.json")) +if f"managed_volume={v1} status=blocked reason=nvme_multipath_path_missing" not in summary: + raise SystemExit("volume 1 degraded summary missing") +if f"managed_volume={v2} status=ready reason=first_volume_verified" not in summary: + raise SystemExit("volume 2 healthy summary missing") +if f"managed_volume_nvme={v1}" not in summary or "path_count=1" not in summary: + raise SystemExit("volume 1 path_count=1 missing") +if f"managed_volume_nvme={v2}" not in summary or "path_count=2" not in summary: + raise SystemExit("volume 2 path_count=2 missing") +vols={v["status"]["volume_id"]: v["status"] for v in snapshot.get("volumes") or []} +if set(vols) != {v1, v2}: + raise SystemExit(f"snapshot IDs mismatch {set(vols)}") +if vols[v1].get("status") != "blocked" or vols[v1].get("reason_code") != "nvme_multipath_path_missing": + raise SystemExit(f"volume 1 snapshot mismatch {vols[v1]}") +if vols[v2].get("status") != "ready" or vols[v2].get("reason_code") != "first_volume_verified": + raise SystemExit(f"volume 2 snapshot mismatch {vols[v2]}") +if (vols[v1].get("nvme") or {}).get("path_count") != 1: + raise SystemExit("volume 1 snapshot path count mismatch") +if (vols[v2].get("nvme") or {}).get("path_count") != 2: + raise SystemExit("volume 2 snapshot path count mismatch") +if any(c.get("type") == "Ready" and c.get("status") == "True" for c in vols[v1].get("conditions") or []): + raise SystemExit("volume 1 false Ready=True while degraded") +(base/"degraded-asserts.txt").write_text("\n".join([ + "degraded_volume_id="+v1, + "untouched_volume_id="+v2, + "degraded_volume_path_count=1", + "untouched_volume_path_count=2", + "degraded_volume_reason=nvme_multipath_path_missing", + "untouched_volume_reason=first_volume_verified", + "cross_volume_reason_mixup=false", + "degraded_surface_ready_true_count=0", +])+"\n") +PY +cat "${ARTIFACT_DIR}/degraded-asserts.txt" >>"${SUMMARY}" + +echo "[phase114] restore volume 1 path" +kubectl -n "${APP_NAMESPACE}" scale "deploy/${TARGET_DEPLOY}" --replicas=1 >"${ARTIFACT_DIR}/inject/restore-target.txt" +kubectl -n "${APP_NAMESPACE}" rollout status "deploy/${TARGET_DEPLOY}" --timeout=240s >"${ARTIFACT_DIR}/inject/rollout-target-restore.txt" 2>&1 +wait_for_volume_states "restored" \ + "sw-block-multi-pvc-1:ready:first_volume_verified:2,sw-block-multi-pvc-2:ready:first_volume_verified:2" +assert_host_nvme_paths "after_restore" 1 "${NQN_1}" 2 +assert_host_nvme_paths "after_restore" 2 "${NQN_2}" 2 + +for idx in $(seq 1 "${VOLUME_COUNT}"); do + pod="sw-block-phase114-mounted-${idx}" + uid_before="$(cat "${ARTIFACT_DIR}/mounted/pod-${idx}.uid.before")" + uid_after="$(kubectl -n "${APP_NAMESPACE}" get pod "${pod}" -o jsonpath='{.metadata.uid}')" + if [[ "${uid_after}" != "${uid_before}" ]]; then + echo "mounted pod ${idx} UID changed after restore: before=${uid_before} after=${uid_after}" >&2 + exit 1 + fi + run_mounted_exec_with_retry "${pod}" "${idx}" "after-restore" "${ARTIFACT_DIR}/mounted/after-restore-${idx}.log" + write_summary "mounted_${idx}_pod_uid_after_restore=${uid_after}" + write_summary "mounted_${idx}_io_after_restore=ok" +done +write_summary "mounted_pods_preserved_after_restore=true" +write_summary "mounted_io_after_restore_count=2" + +with_master_port_forward "${ARTIFACT_DIR}/surfaces/restored-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/restored-report" \ + --timeout 30s >"${ARTIFACT_DIR}/surfaces/restored-report.stdout.txt" 2>"${ARTIFACT_DIR}/surfaces/restored-report.stderr.txt" + +python3 - "${ARTIFACT_DIR}" "${VOLUME_ID_1}" "${VOLUME_ID_2}" <<'PY' +import json, sys +from pathlib import Path +base=Path(sys.argv[1]) +ids=sys.argv[2:4] +summary=(base/"surfaces/restored-report/summary.txt").read_text() +snapshot=json.load(open(base/"surfaces/restored-report/operator-snapshot.json")) +vols={v["status"]["volume_id"]: v["status"] for v in snapshot.get("volumes") or []} +for volume_id in ids: + if f"managed_volume={volume_id} status=ready reason=first_volume_verified" not in summary: + raise SystemExit(f"restored summary missing ready {volume_id}") + if f"managed_volume_nvme={volume_id}" not in summary or "path_count=2" not in summary: + raise SystemExit(f"restored summary missing path_count=2 {volume_id}") + st=vols.get(volume_id) + if not st or st.get("status") != "ready" or st.get("reason_code") != "first_volume_verified": + raise SystemExit(f"restored snapshot mismatch {volume_id}: {st}") + if (st.get("nvme") or {}).get("path_count") != 2: + raise SystemExit(f"restored snapshot path_count mismatch {volume_id}") +(base/"restored-asserts.txt").write_text("\n".join([ + "restored_volume_count=2", + "restored_all_path_count=2", + "restored_all_reason=first_volume_verified", +])+"\n") +PY +cat "${ARTIFACT_DIR}/restored-asserts.txt" >>"${SUMMARY}" + +write_summary "phase114_nvme_k8s_multivolume_mounted_path_isolation_status=ok" + +cleanup +verify_rc=0 +( + cd "${ROOT}" + SW_BLOCK_CLEANUP_WAIT_SECONDS=180 \ + SW_BLOCK_ARTIFACT_DIR="${ARTIFACT_DIR}/cleanup/verify" bash scripts/verify-helm-cleanup.sh "${ROOT}" \ + >"${ARTIFACT_DIR}/cleanup/verify.stdout.txt" 2>"${ARTIFACT_DIR}/cleanup/verify.stderr.txt" +) || verify_rc=$? +cat "${ARTIFACT_DIR}/cleanup/verify/cleanup-summary.txt" >>"${SUMMARY}" +grep -q '^cleanup_status=ok$' "${ARTIFACT_DIR}/cleanup/verify/cleanup-summary.txt" +if [[ "${verify_rc}" -ne 0 ]]; then + exit "${verify_rc}" +fi + +echo "[phase114] PASS" diff --git a/seaweed-block/testops/scenarios/nvme-tcp-k8s-multivolume-mounted-path-isolation-chain.yaml b/seaweed-block/testops/scenarios/nvme-tcp-k8s-multivolume-mounted-path-isolation-chain.yaml new file mode 100644 index 0000000000..1f20a97286 --- /dev/null +++ b/seaweed-block/testops/scenarios/nvme-tcp-k8s-multivolume-mounted-path-isolation-chain.yaml @@ -0,0 +1,154 @@ +name: nvme-tcp-k8s-multivolume-mounted-path-isolation-chain +timeout: 70m + +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 sw-block-phase114-mounted-1 sw-block-phase114-mounted-2 --ignore-not-found=true --wait=true --timeout=120s || true; kubectl -n default delete pod -l sw-block-test=multi-volume --ignore-not-found=true --wait=true --timeout=120s || true; for i in 1 2; do kubectl -n default delete pod sw-block-multi-reader-$i sw-block-multi-writer-$i --ignore-not-found=true --wait=true --timeout=120s || true; kubectl -n default delete pvc sw-block-multi-pvc-$i --ignore-not-found=true --wait=true --timeout=120s || true; done; 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 }}-phase114-nvme-multivolume-mounted-path-isolation && mkdir -p /mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase114-nvme-multivolume-mounted-path-isolation/build /mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase114-nvme-multivolume-mounted-path-isolation/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 }}-phase114-nvme-multivolume-mounted-path-isolation/build" + - action: grep_log + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase114-nvme-multivolume-mounted-path-isolation/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_phase114_gate + actions: + - action: exec + node: m02 + timeout: 55m + cmd: "cd {{ product_root }} && bash scripts/run-phase114-nvme-k8s-multivolume-mounted-path-isolation-gate.sh {{ product_root }}" + env.KUBECONFIG: "/etc/rancher/k3s/k3s.yaml" + env.SW_BLOCK_ARTIFACT_DIR: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase114-nvme-multivolume-mounted-path-isolation/gate" + - action: grep_log + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase114-nvme-multivolume-mounted-path-isolation/gate/phase114-nvme-k8s-multivolume-mounted-path-isolation-summary.txt" + pattern: "^phase114_nvme_k8s_multivolume_mounted_path_isolation_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 }}-phase114-nvme-multivolume-mounted-path-isolation/gate/phase114-nvme-k8s-multivolume-mounted-path-isolation-summary.txt" + pattern: "^mounted_pods_preserved_after_loss=true$" + save_as: pods_preserved_after_loss + - action: assert_greater + actual: "{{ pods_preserved_after_loss }}" + threshold: "0" + - action: grep_log + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase114-nvme-multivolume-mounted-path-isolation/gate/phase114-nvme-k8s-multivolume-mounted-path-isolation-summary.txt" + pattern: "^mounted_io_after_loss_count=2$" + save_as: mounted_io_after_loss + - action: assert_greater + actual: "{{ mounted_io_after_loss }}" + threshold: "0" + - action: grep_log + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase114-nvme-multivolume-mounted-path-isolation/gate/phase114-nvme-k8s-multivolume-mounted-path-isolation-summary.txt" + pattern: "^degraded_volume_path_count=1$" + save_as: degraded_path_count + - action: assert_greater + actual: "{{ degraded_path_count }}" + threshold: "0" + - action: grep_log + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase114-nvme-multivolume-mounted-path-isolation/gate/phase114-nvme-k8s-multivolume-mounted-path-isolation-summary.txt" + pattern: "^untouched_volume_path_count=2$" + save_as: untouched_path_count + - action: assert_greater + actual: "{{ untouched_path_count }}" + threshold: "0" + - action: grep_log + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase114-nvme-multivolume-mounted-path-isolation/gate/phase114-nvme-k8s-multivolume-mounted-path-isolation-summary.txt" + pattern: "^cross_volume_reason_mixup=false$" + save_as: no_cross_reason + - action: assert_greater + actual: "{{ no_cross_reason }}" + threshold: "0" + - action: grep_log + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase114-nvme-multivolume-mounted-path-isolation/gate/phase114-nvme-k8s-multivolume-mounted-path-isolation-summary.txt" + pattern: "^mounted_pods_preserved_after_restore=true$" + save_as: pods_preserved_after_restore + - action: assert_greater + actual: "{{ pods_preserved_after_restore }}" + threshold: "0" + - action: grep_log + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase114-nvme-multivolume-mounted-path-isolation/gate/phase114-nvme-k8s-multivolume-mounted-path-isolation-summary.txt" + pattern: "^mounted_io_after_restore_count=2$" + save_as: mounted_io_after_restore + - action: assert_greater + actual: "{{ mounted_io_after_restore }}" + threshold: "0" + - action: grep_log + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase114-nvme-multivolume-mounted-path-isolation/gate/phase114-nvme-k8s-multivolume-mounted-path-isolation-summary.txt" + pattern: "^restored_volume_count=2$" + save_as: restored_volume_count + - action: assert_greater + actual: "{{ restored_volume_count }}" + threshold: "0" + - action: grep_log + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase114-nvme-multivolume-mounted-path-isolation/gate/phase114-nvme-k8s-multivolume-mounted-path-isolation-summary.txt" + pattern: "^restored_all_path_count=2$" + save_as: restored_path_count + - action: assert_greater + actual: "{{ restored_path_count }}" + threshold: "0" + - action: grep_log + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase114-nvme-multivolume-mounted-path-isolation/gate/phase114-nvme-k8s-multivolume-mounted-path-isolation-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 }}-phase114-nvme-multivolume-mounted-path-isolation" + name: "remote-phases" + ignore_error: true