mirror of https://github.com/k3s-io/k3s
Support iqn as well as eui format for iSCSI entity names.
Supported formats are : iqn.<date code>.<reversed domain>[:<optional suffix>] eui.<eui-64 identifier>pull/6/head
parent
949cf9e9da
commit
18c82f743c
|
@ -179,6 +179,9 @@ func extractPortalAndIqn(device string) (string, string, error) {
|
|||
}
|
||||
portal := device[0:ind1]
|
||||
ind2 := strings.Index(device, "iqn.")
|
||||
if ind2 < 0 {
|
||||
ind2 = strings.Index(device, "eui.")
|
||||
}
|
||||
if ind2 < 0 {
|
||||
return "", "", fmt.Errorf("iscsi detach disk: no iqn in %s", device)
|
||||
}
|
||||
|
|
|
@ -68,4 +68,9 @@ func TestExtractPortalAndIqn(t *testing.T) {
|
|||
if err != nil || portal != "127.0.0.1:3260" || iqn != "iqn.2014-12.com.example:test.tgt00" {
|
||||
t.Errorf("extractPortalAndIqn: got %v %s %s", err, portal, iqn)
|
||||
}
|
||||
devicePath = "127.0.0.1:3260-eui.02004567A425678D-lun-0"
|
||||
portal, iqn, err = extractPortalAndIqn(devicePath)
|
||||
if err != nil || portal != "127.0.0.1:3260" || iqn != "eui.02004567A425678D" {
|
||||
t.Errorf("extractPortalAndIqn: got %v %s %s", err, portal, iqn)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue