Merge pull request #17711 from anish/iqn_format

Auto commit by PR queue bot
pull/6/head
k8s-merge-robot 2015-11-26 23:22:17 -08:00
commit d3d3f94e2f
2 changed files with 8 additions and 0 deletions

View File

@ -179,6 +179,9 @@ func extractPortalAndIqn(device string) (string, string, error) {
} }
portal := device[0:ind1] portal := device[0:ind1]
ind2 := strings.Index(device, "iqn.") ind2 := strings.Index(device, "iqn.")
if ind2 < 0 {
ind2 = strings.Index(device, "eui.")
}
if ind2 < 0 { if ind2 < 0 {
return "", "", fmt.Errorf("iscsi detach disk: no iqn in %s", device) return "", "", fmt.Errorf("iscsi detach disk: no iqn in %s", device)
} }

View File

@ -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" { 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) 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)
}
} }