mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
Merge pull request #81631 from tedyu/vol-local-rmdir
Log the error return from dir removal
This commit is contained in:
commit
5713c22eec
@ -313,7 +313,9 @@ func (dm *deviceMounter) mountLocalBlockDevice(spec *volume.Spec, devicePath str
|
|||||||
mountOptions := util.MountOptionFromSpec(spec, options...)
|
mountOptions := util.MountOptionFromSpec(spec, options...)
|
||||||
err = dm.mounter.FormatAndMount(devicePath, deviceMountPath, fstype, mountOptions)
|
err = dm.mounter.FormatAndMount(devicePath, deviceMountPath, fstype, mountOptions)
|
||||||
if err != nil {
|
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)
|
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)
|
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
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
os.Remove(dir)
|
if rmErr := os.Remove(dir); rmErr != nil {
|
||||||
|
klog.Warningf("failed to remove %s: %v", dir, rmErr)
|
||||||
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if !m.readOnly {
|
if !m.readOnly {
|
||||||
|
Loading…
Reference in New Issue
Block a user