mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-05 02:27:26 +01:00
fix: the iSCSI multipath grouping binds IQN and LUN; NONBLOCKING row names the live renewal control
codex01 review of #416 2cba5881: two primary-owned units of one IQN (q/LUN1 at A, q/LUN2 at B) are two targets, never one multipath target with LUN1 for both. Control added. INV-WS-RENEW-NONBLOCKING-001 lists TestLiveRenewalDoesNotWaitForAHeldRegistrationWrite. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8d103b2c85
commit
a2e9930d49
3 files changed
+20
-7
No files matched your search
@@ -168,20 +168,23 @@ func publishTargetFromStatus(resp *control.StatusResponse, enableMultipath bool,
|
||||
if ft.GetProtocol() != string(ProtocolISCSI) || ft.GetAddr() == "" || ft.GetIqn() == "" || rejectFrontendAddr(ft.GetAddr(), rejectLoopback) {
|
||||
continue
|
||||
}
|
||||
if _, ok := iscsiByIQN[ft.GetIqn()]; !ok {
|
||||
iscsiOrder = append(iscsiOrder, ft.GetIqn())
|
||||
// one multipath target is one IQN AND LUN: paths to another LUN of the same IQN are another unit
|
||||
// (INV-AUTH-HOLDER-IDENTITY-001)
|
||||
key := ft.GetIqn() + "\x00" + strconv.FormatUint(uint64(ft.GetLun()), 10)
|
||||
if _, ok := iscsiByIQN[key]; !ok {
|
||||
iscsiOrder = append(iscsiOrder, key)
|
||||
}
|
||||
iscsiByIQN[ft.GetIqn()] = append(iscsiByIQN[ft.GetIqn()], ft)
|
||||
iscsiByIQN[key] = append(iscsiByIQN[key], ft)
|
||||
}
|
||||
for _, iqn := range iscsiOrder {
|
||||
frontends := iscsiByIQN[iqn]
|
||||
for _, key := range iscsiOrder {
|
||||
frontends := iscsiByIQN[key]
|
||||
if len(frontends) == 0 {
|
||||
continue
|
||||
}
|
||||
out := base
|
||||
out.Protocol = ProtocolISCSI
|
||||
out.ISCSIAddr = frontends[0].GetAddr()
|
||||
out.IQN = iqn
|
||||
out.IQN = frontends[0].GetIqn()
|
||||
out.LUN = frontends[0].GetLun()
|
||||
if len(frontends) > 1 {
|
||||
out.Multipath = true
|
||||
|
||||
@@ -45,6 +45,16 @@ func TestPublishTargetIsPrimaryOwned(t *testing.T) {
|
||||
if !ok || got.LUN != 1 || !got.Multipath || len(got.ISCSIAddrs) != 2 || got.ISCSIAddrs[0] != "192.0.2.1:3260" {
|
||||
t.Fatalf("nonzero LUN match: %+v ok=%v, want multipath primary-first at LUN 1", got, ok)
|
||||
}
|
||||
// two PRIMARY-owned units of one IQN (q/LUN1 at A, q/LUN2 at B) are two targets, never one multipath target with
|
||||
// LUN1 for both (codex01: the final grouping binds IQN and LUN too)
|
||||
got, ok = publishTargetFromStatus(status(lun("r1", "192.0.2.1:3260", 1), lun("r1", "192.0.2.2:3260", 2)), true, false)
|
||||
if !ok || got.ISCSIAddr != "192.0.2.1:3260" || got.LUN != 1 || got.Multipath || len(got.ISCSIAddrs) != 0 {
|
||||
t.Fatalf("two primary units: %+v ok=%v, want q/LUN1 at 192.0.2.1 alone (no multipath with LUN2's path)", got, ok)
|
||||
}
|
||||
got, ok = publishTargetFromStatus(status(lun("", "192.0.2.1:3260", 1), lun("", "192.0.2.2:3260", 2)), true, false)
|
||||
if !ok || got.LUN != 1 || got.Multipath {
|
||||
t.Fatalf("untagged two units: %+v ok=%v, want q/LUN1 alone", got, ok)
|
||||
}
|
||||
// no primary frontend at all, supporting present: no target
|
||||
if got, ok := publishTargetFromStatus(status(ft("r2", "192.0.2.2:3260", "iqn.v1")), false, false); ok {
|
||||
t.Fatalf("no primary frontend: published %+v, want no target", got)
|
||||
|
||||
@@ -110,7 +110,7 @@ The role a blockvolume takes from each assignment, its replica listener's admiss
|
||||
```mermaid
|
||||
stateDiagram-v2
|
||||
[*] --> Unassigned: listener with a floor record, no role yet
|
||||
Unassigned --> Primary: fact names self (server id + replica, delivered only to its registered host), listener fenced at e
|
||||
Unassigned --> Primary: fact names self, listener fenced at e
|
||||
Unassigned --> Supporting: fact names another primary, self in peers
|
||||
Supporting --> Primary: promotion, fact names self at a higher epoch
|
||||
Primary --> Supporting: fact names another primary, self in peers
|
||||
|
||||
Reference in new issue
Block a user