Skip to content

Commit a730ad5

Browse files
authored
Merge pull request kubernetes#92345 from brianpursley/unmount-handle-not-found
Make unmount device log warning and continue if mount path is not found
2 parents a03db63 + 4cc4e77 commit a730ad5

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

pkg/volume/util/operationexecutor/operation_generator.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -835,8 +835,15 @@ func (og *operationGenerator) GenerateUnmountDeviceFunc(
835835
deviceMountPath, err :=
836836
volumeDeviceMounter.GetDeviceMountPath(deviceToDetach.VolumeSpec)
837837
if err != nil {
838-
// On failure, return error. Caller will log and retry.
839-
return deviceToDetach.GenerateError("GetDeviceMountPath failed", err)
838+
// On failure other than "does not exist", return error. Caller will log and retry.
839+
if !strings.Contains(err.Error(), "does not exist") {
840+
return deviceToDetach.GenerateError("GetDeviceMountPath failed", err)
841+
}
842+
// If the mount path could not be found, don't fail the unmount, but instead log a warning and proceed,
843+
// using the value from deviceToDetach.DeviceMountPath, so that the device can be marked as unmounted
844+
deviceMountPath = deviceToDetach.DeviceMountPath
845+
klog.Warningf(deviceToDetach.GenerateMsg(fmt.Sprintf(
846+
"GetDeviceMountPath failed, but unmount operation will proceed using deviceMountPath=%s: %v", deviceMountPath, err), ""))
840847
}
841848
refs, err := deviceMountableVolumePlugin.GetDeviceMountRefs(deviceMountPath)
842849

0 commit comments

Comments
 (0)