Skip to content
Permalink
Browse files

Merge pull request #81631 from tedyu/vol-local-rmdir

Log the error return from dir removal
  • Loading branch information...
k8s-ci-robot committed Aug 22, 2019
2 parents 6b47754 + dad86eb commit 5713c22eecff4610026643fbd3d37c33a43c168d
Showing with 6 additions and 2 deletions.
  1. +6 −2 pkg/volume/local/local.go
@@ -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)
@@ -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 {

0 comments on commit 5713c22

Please sign in to comment.
You can’t perform that action at this time.