mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
fix: comments(only create parent dir)
This commit is contained in:
parent
b3a27c44bf
commit
8d5c65b8cd
@ -276,16 +276,12 @@ func (c *csiAttacher) MountDevice(spec *volume.Spec, devicePath string, deviceMo
|
||||
|
||||
// Store volume metadata for UnmountDevice. Keep it around even if the
|
||||
// driver does not support NodeStage, UnmountDevice still needs it.
|
||||
if err = os.MkdirAll(deviceMountPath, 0750); err != nil {
|
||||
if isCorruptedDir(deviceMountPath) {
|
||||
// leave to CSI driver to handle corrupted mount
|
||||
klog.Warning(log("attacher.MountDevice detected corrupted mount for dir [%s]", deviceMountPath))
|
||||
} else {
|
||||
return errors.New(log("attacher.MountDevice failed to create dir %#v: %v", deviceMountPath, err))
|
||||
}
|
||||
parentDir := filepath.Dir(deviceMountPath)
|
||||
if err = os.MkdirAll(parentDir, 0750); err != nil {
|
||||
return errors.New(log("attacher.MountDevice failed to create dir %#v: %v", parentDir, err))
|
||||
}
|
||||
klog.V(4).Info(log("created target path successfully [%s]", deviceMountPath))
|
||||
dataDir := filepath.Dir(deviceMountPath)
|
||||
klog.V(4).Info(log("created target path successfully [%s]", parentDir))
|
||||
dataDir := parentDir
|
||||
data := map[string]string{
|
||||
volDataKey.volHandle: csiSource.VolumeHandle,
|
||||
volDataKey.driverName: csiSource.Driver,
|
||||
|
@ -202,15 +202,11 @@ func (c *csiMountMgr) SetUpAt(dir string, mounterArgs volume.MounterArgs) error
|
||||
}
|
||||
|
||||
// create target_dir before call to NodePublish
|
||||
if err := os.MkdirAll(dir, 0750); err != nil {
|
||||
if isCorruptedDir(dir) {
|
||||
// leave to CSI driver to handle corrupted mount
|
||||
klog.Warning(log("mounter.SetUpAt detected corrupted mount for dir [%s]", dir))
|
||||
} else {
|
||||
return errors.New(log("mounter.SetUpAt failed to create dir %#v: %v", dir, err))
|
||||
}
|
||||
parentDir := filepath.Dir(dir)
|
||||
if err := os.MkdirAll(parentDir, 0750); err != nil {
|
||||
return errors.New(log("mounter.SetUpAt failed to create dir %#v: %v", parentDir, err))
|
||||
}
|
||||
klog.V(4).Info(log("created target path successfully [%s]", dir))
|
||||
klog.V(4).Info(log("created target path successfully [%s]", parentDir))
|
||||
|
||||
nodePublishSecrets = map[string]string{}
|
||||
if secretRef != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user