Skip to content

Commit aa8e4fe

Browse files
authored
Merge pull request #477 from yussufsh/main
Improve delete device failure logs in driver node
2 parents f9952d3 + 905cea4 commit aa8e4fe

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

pkg/device/multipath.go

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -79,39 +79,40 @@ func retryCleanupDevice(dev *Device) error {
7979
}
8080

8181
// multipathDisableQueuing disable queueing on the multipath device
82-
func multipathDisableQueuing(mapper string) (err error) {
82+
func multipathDisableQueuing(mapper string) error {
8383
args := []string{"message", mapper, "0", "fail_if_no_path"}
8484
outBytes, err := exec.Command(dmsetupcommand, args...).CombinedOutput()
85+
out := string(outBytes)
8586
if err != nil {
86-
return err
87+
return fmt.Errorf("cannot disable queuing: %s : %v", out, err)
8788
}
88-
out := string(outBytes)
8989
if strings.Contains(out, deviceDoesNotExist) {
9090
return fmt.Errorf("cannot disable queuing: %s", out)
9191
}
9292
return nil
9393
}
9494

9595
// multipathRemoveDmDevice remove multipath device via dmsetup
96-
func multipathRemoveDmDevice(mapper string) (err error) {
96+
func multipathRemoveDmDevice(mapper string) error {
9797
if strings.HasSuffix(mapper, "mpatha") {
9898
klog.Warning("skipping remove mpatha which is root")
99-
return
99+
return nil
100100
}
101101

102-
err = multipathDisableQueuing(mapper)
103-
if err != nil {
102+
// Any failure while performing disable queuing operation on the device map
103+
// will be ignored and will try to delete it.
104+
if err := multipathDisableQueuing(mapper); err != nil {
104105
klog.Warningf("failure while disabling queue for %s: %v", mapper, err)
105106
}
106107

107108
args := []string{"remove", "--force", mapper}
108109
outBytes, err := exec.Command(dmsetupcommand, args...).CombinedOutput()
110+
out := string(outBytes)
109111
if err != nil {
110-
return fmt.Errorf("failed to remove multipath map for %s, error: %v", mapper, err)
112+
return fmt.Errorf("failed to remove device map for %s : %s : %v", mapper, out, err)
111113
}
112-
out := string(outBytes)
113114
if isDmsetupRemoveError(out) {
114-
return fmt.Errorf("failed to remove device map for %s, error: %s", mapper, out)
115+
return fmt.Errorf("failed to remove device map for %s : %s", mapper, out)
115116
}
116117
return nil
117118
}

0 commit comments

Comments
 (0)