mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 05:57:25 +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
|
// Store volume metadata for UnmountDevice. Keep it around even if the
|
||||||
// driver does not support NodeStage, UnmountDevice still needs it.
|
// driver does not support NodeStage, UnmountDevice still needs it.
|
||||||
if err = os.MkdirAll(deviceMountPath, 0750); err != nil {
|
parentDir := filepath.Dir(deviceMountPath)
|
||||||
if isCorruptedDir(deviceMountPath) {
|
if err = os.MkdirAll(parentDir, 0750); err != nil {
|
||||||
// leave to CSI driver to handle corrupted mount
|
return errors.New(log("attacher.MountDevice failed to create dir %#v: %v", parentDir, err))
|
||||||
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))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
klog.V(4).Info(log("created target path successfully [%s]", deviceMountPath))
|
klog.V(4).Info(log("created target path successfully [%s]", parentDir))
|
||||||
dataDir := filepath.Dir(deviceMountPath)
|
dataDir := parentDir
|
||||||
data := map[string]string{
|
data := map[string]string{
|
||||||
volDataKey.volHandle: csiSource.VolumeHandle,
|
volDataKey.volHandle: csiSource.VolumeHandle,
|
||||||
volDataKey.driverName: csiSource.Driver,
|
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
|
// create target_dir before call to NodePublish
|
||||||
if err := os.MkdirAll(dir, 0750); err != nil {
|
parentDir := filepath.Dir(dir)
|
||||||
if isCorruptedDir(dir) {
|
if err := os.MkdirAll(parentDir, 0750); err != nil {
|
||||||
// leave to CSI driver to handle corrupted mount
|
return errors.New(log("mounter.SetUpAt failed to create dir %#v: %v", parentDir, err))
|
||||||
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))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
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{}
|
nodePublishSecrets = map[string]string{}
|
||||||
if secretRef != nil {
|
if secretRef != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user