Skip to content

Commit de0ae4d

Browse files
committed
fix: do not return from Connect if device path does not exist
Connect function should not return on an error from waitForPathToExist unless all device paths cannot be found.
1 parent a7cb39b commit de0ae4d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

iscsi/iscsi.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -312,15 +312,15 @@ func Connect(c *Connector) (string, error) {
312312
exists, _ := sessionExists(p, target.Iqn)
313313
if exists {
314314
debug.Printf("Session already exists, checking if device path %q exists", devicePath)
315-
exists, err := waitForPathToExist(&devicePath, int(c.RetryCount), int(c.CheckInterval), iscsiTransport)
316-
debug.Printf("waitForPathToExist: exists=%v err=%v", exists, err)
317-
if exists {
315+
devPathExists, err := waitForPathToExist(&devicePath, int(c.RetryCount), int(c.CheckInterval), iscsiTransport)
316+
debug.Printf("waitForPathToExist: exists=%v err=%v", devPathExists, err)
317+
if devPathExists {
318318
debug.Printf("Appending device path: %s", devicePath)
319319
devicePaths = append(devicePaths, devicePath)
320-
continue
321320
} else if err != nil {
322-
return "", err
321+
lastErr = err
323322
}
323+
continue
324324
}
325325

326326
if c.DoDiscovery {

0 commit comments

Comments
 (0)