Merge pull request #94781 from ejweber/fc-attacher-empty-devname

Don't attempt to detach an FC device if we don't know its name
This commit is contained in:
Kubernetes Prow Robot 2020-09-22 18:34:22 -07:00 committed by GitHub
commit 796f9d89ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -165,6 +165,11 @@ func (detacher *fcDetacher) UnmountDevice(deviceMountPath string) error {
if err != nil {
return fmt.Errorf("fc: failed to unmount: %s\nError: %v", deviceMountPath, err)
}
// GetDeviceNameFromMount from above returns an empty string if deviceMountPath is not a mount point
// There is no need to DetachDisk if this is the case (and DetachDisk will throw an error if we attempt)
if devName == "" {
return nil
}
unMounter := volumeSpecToUnmounter(detacher.mounter)
err = detacher.manager.DetachDisk(*unMounter, devName)
if err != nil {