Don't attempt to detach an FC device if we don't know its name

This commit is contained in:
Eric Weber 2020-09-11 16:31:03 -05:00
parent 79cc8be2cd
commit 5cd63097ba

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 {