Skip to content

Commit 4fb6a1f

Browse files
committed
fix: reduce multipath delay to 10s, use ExitCode
Signed-off-by: Joe Skazinski <joseph.skazinski@seagate.com>
1 parent 8fb98fb commit 4fb6a1f

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

iscsi/iscsi.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import (
1919
const (
2020
defaultPort = "3260"
2121
maxMultipathAttempts = 10
22-
multipathDelay = 30
22+
multipathDelay = 10
2323
)
2424

2525
var (
@@ -162,7 +162,7 @@ func waitForPathToExistImpl(devicePath *string, maxRetries, intervalSeconds int,
162162
err = nil
163163
if deviceTransport == "tcp" {
164164
_, err = osStat(*devicePath)
165-
debug.Printf("os stat device: exist %v device %v", !os.IsNotExist(err), *devicePath)
165+
debug.Printf("[%d] os stat device: exist %v device %v", i, !os.IsNotExist(err), *devicePath)
166166
if err != nil && !os.IsNotExist(err) {
167167
debug.Printf("Error attempting to stat device: %s", err.Error())
168168
return false, err
@@ -171,7 +171,7 @@ func waitForPathToExistImpl(devicePath *string, maxRetries, intervalSeconds int,
171171
}
172172

173173
} else {
174-
debug.Printf("filepathGlob: %s", *devicePath)
174+
debug.Printf("[%d] filepathGlob: %s", i, *devicePath)
175175
fpath, _ := filepathGlob(*devicePath)
176176
if fpath == nil {
177177
err = os.ErrNotExist
@@ -191,6 +191,7 @@ func waitForPathToExistImpl(devicePath *string, maxRetries, intervalSeconds int,
191191
}
192192
time.Sleep(time.Second * time.Duration(intervalSeconds))
193193
}
194+
debug.Printf("device does NOT exist [%d*%ds] (%v)", maxRetries, intervalSeconds, *devicePath)
194195
return false, err
195196
}
196197

iscsi/multipath.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import (
77
"os"
88
"os/exec"
99
"path/filepath"
10-
"syscall"
1110
"time"
1211
)
1312

@@ -112,8 +111,8 @@ func RemoveAndClear(device string) error {
112111
debug.Printf("dmsetup remove -f %s\n", device)
113112
if output, err := execCommand("dmsetup", "remove", "-f", device).CombinedOutput(); err != nil {
114113
exitErr, ok := err.(*exec.ExitError)
115-
if ok && exitErr.ProcessState.Sys().(syscall.WaitStatus).ExitStatus() != 0 {
116-
debug.Printf("ERROR: dmsetup remove -f ExitStatus: %d, err=%v\n", exitErr.ProcessState.Sys().(syscall.WaitStatus).ExitStatus(), err)
114+
if ok && exitErr.ExitCode() != 0 {
115+
debug.Printf("ERROR: dmsetup remove -f ExitCode: %d, err=%v\n", exitErr.ExitCode(), err)
117116
}
118117

119118
return fmt.Errorf("device-mapper could not remove device: %s (%v)", output, err)

0 commit comments

Comments
 (0)