Merge pull request #92345 from brianpursley/unmount-handle-not-found

Make unmount device log warning and continue if mount path is not found
This commit is contained in:
Kubernetes Prow Robot 2020-06-26 04:17:45 -07:00 committed by GitHub
commit a730ad56b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -835,8 +835,15 @@ func (og *operationGenerator) GenerateUnmountDeviceFunc(
deviceMountPath, err :=
volumeDeviceMounter.GetDeviceMountPath(deviceToDetach.VolumeSpec)
if err != nil {
// On failure, return error. Caller will log and retry.
return deviceToDetach.GenerateError("GetDeviceMountPath failed", err)
// On failure other than "does not exist", return error. Caller will log and retry.
if !strings.Contains(err.Error(), "does not exist") {
return deviceToDetach.GenerateError("GetDeviceMountPath failed", err)
}
// If the mount path could not be found, don't fail the unmount, but instead log a warning and proceed,
// using the value from deviceToDetach.DeviceMountPath, so that the device can be marked as unmounted
deviceMountPath = deviceToDetach.DeviceMountPath
klog.Warningf(deviceToDetach.GenerateMsg(fmt.Sprintf(
"GetDeviceMountPath failed, but unmount operation will proceed using deviceMountPath=%s: %v", deviceMountPath, err), ""))
}
refs, err := deviceMountableVolumePlugin.GetDeviceMountRefs(deviceMountPath)