Merge pull request #107789 from gnufied/mark-device-uncertain-inuse

Mark device as uncertain if unmount device succeeds
This commit is contained in:
Kubernetes Prow Robot 2022-01-26 08:28:03 -08:00 committed by GitHub
commit be38633742
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1015,6 +1015,12 @@ func (og *operationGenerator) GenerateUnmountDeviceFunc(
} }
// The device is still in use elsewhere. Caller will log and retry. // The device is still in use elsewhere. Caller will log and retry.
if deviceOpened { if deviceOpened {
// Mark the device as uncertain, so MountDevice is called for new pods.
markDeviceUncertainErr := actualStateOfWorld.MarkDeviceAsUncertain(deviceToDetach.VolumeName, deviceToDetach.DevicePath, deviceMountPath)
if markDeviceUncertainErr != nil {
// There is nothing else we can do. Hope that UnmountDevice will be re-tried shortly.
klog.Errorf(deviceToDetach.GenerateErrorDetailed("UnmountDevice.MarkDeviceAsUncertain failed", markDeviceUncertainErr).Error())
}
eventErr, detailedErr := deviceToDetach.GenerateError( eventErr, detailedErr := deviceToDetach.GenerateError(
"UnmountDevice failed", "UnmountDevice failed",
goerrors.New("the device is in use when it was no longer expected to be in use")) goerrors.New("the device is in use when it was no longer expected to be in use"))