Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log the error return from dir removal #81631

Merged
merged 1 commit into from
Aug 22, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 6 additions & 2 deletions pkg/volume/local/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,9 @@ func (dm *deviceMounter) mountLocalBlockDevice(spec *volume.Spec, devicePath str
mountOptions := util.MountOptionFromSpec(spec, options...)
err = dm.mounter.FormatAndMount(devicePath, deviceMountPath, fstype, mountOptions)
if err != nil {
os.Remove(deviceMountPath)
if rmErr := os.Remove(deviceMountPath); rmErr != nil {
klog.Warningf("local: failed to remove %s: %v", deviceMountPath, rmErr)
}
return fmt.Errorf("local: failed to mount device %s at %s (fstype: %s), error %v", devicePath, deviceMountPath, fstype, err)
}
klog.V(3).Infof("local: successfully mount device %s at %s (fstype: %s)", devicePath, deviceMountPath, fstype)
Expand Down Expand Up @@ -531,7 +533,9 @@ func (m *localVolumeMounter) SetUpAt(dir string, mounterArgs volume.MounterArgs)
return err
}
}
os.Remove(dir)
if rmErr := os.Remove(dir); rmErr != nil {
klog.Warningf("failed to remove %s: %v", dir, rmErr)
}
return err
}
if !m.readOnly {
Expand Down