@@ -79,39 +79,40 @@ func retryCleanupDevice(dev *Device) error {
79
79
}
80
80
81
81
// multipathDisableQueuing disable queueing on the multipath device
82
- func multipathDisableQueuing (mapper string ) ( err error ) {
82
+ func multipathDisableQueuing (mapper string ) error {
83
83
args := []string {"message" , mapper , "0" , "fail_if_no_path" }
84
84
outBytes , err := exec .Command (dmsetupcommand , args ... ).CombinedOutput ()
85
+ out := string (outBytes )
85
86
if err != nil {
86
- return err
87
+ return fmt . Errorf ( "cannot disable queuing: %s : %v" , out , err )
87
88
}
88
- out := string (outBytes )
89
89
if strings .Contains (out , deviceDoesNotExist ) {
90
90
return fmt .Errorf ("cannot disable queuing: %s" , out )
91
91
}
92
92
return nil
93
93
}
94
94
95
95
// multipathRemoveDmDevice remove multipath device via dmsetup
96
- func multipathRemoveDmDevice (mapper string ) ( err error ) {
96
+ func multipathRemoveDmDevice (mapper string ) error {
97
97
if strings .HasSuffix (mapper , "mpatha" ) {
98
98
klog .Warning ("skipping remove mpatha which is root" )
99
- return
99
+ return nil
100
100
}
101
101
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 {
104
105
klog .Warningf ("failure while disabling queue for %s: %v" , mapper , err )
105
106
}
106
107
107
108
args := []string {"remove" , "--force" , mapper }
108
109
outBytes , err := exec .Command (dmsetupcommand , args ... ).CombinedOutput ()
110
+ out := string (outBytes )
109
111
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 )
111
113
}
112
- out := string (outBytes )
113
114
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 )
115
116
}
116
117
return nil
117
118
}
0 commit comments