mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 13:37:30 +00:00
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:
commit
a730ad56b9
@ -835,9 +835,16 @@ func (og *operationGenerator) GenerateUnmountDeviceFunc(
|
|||||||
deviceMountPath, err :=
|
deviceMountPath, err :=
|
||||||
volumeDeviceMounter.GetDeviceMountPath(deviceToDetach.VolumeSpec)
|
volumeDeviceMounter.GetDeviceMountPath(deviceToDetach.VolumeSpec)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// On failure, return error. Caller will log and retry.
|
// 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)
|
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)
|
refs, err := deviceMountableVolumePlugin.GetDeviceMountRefs(deviceMountPath)
|
||||||
|
|
||||||
if err != nil || util.HasMountRefs(deviceMountPath, refs) {
|
if err != nil || util.HasMountRefs(deviceMountPath, refs) {
|
||||||
|
Loading…
Reference in New Issue
Block a user