Skip to content

Commit 800917e

Browse files
committed
fix: Use iterations for multipath discovery as needed
Signed-off-by: Joe Skazinski <[email protected]>
1 parent 3718622 commit 800917e

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

iscsi/iscsi.go

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -210,11 +210,20 @@ func getMultipathDisk(path string) (string, error) {
210210
// Fallback to iterating through all the entries under /sys/block/dm-* and
211211
// check to see if any have an entry under /sys/block/dm-*/slaves matching
212212
// the device the symlink was pointing at
213+
attempts := 1
213214
dmPaths, err := filepath.Glob("/sys/block/dm-*")
214-
debug.Printf("-- dmPaths=%v", dmPaths)
215-
if err != nil {
216-
debug.Printf("Glob error: %s", err)
217-
return "", err
215+
for attempts < 4 {
216+
debug.Printf("[%d] dmPaths=%v", attempts, dmPaths)
217+
if err != nil {
218+
debug.Printf("Glob error: %s", err)
219+
return "", err
220+
}
221+
if len(dmPaths) > 0 {
222+
break
223+
}
224+
time.Sleep(1 * time.Second)
225+
attempts++
226+
dmPaths, err = filepath.Glob("/sys/block/dm-*")
218227
}
219228
for _, dmPath := range dmPaths {
220229
sdevices, err := filepath.Glob(filepath.Join(dmPath, "slaves", "*"))

0 commit comments

Comments
 (0)