Skip to content

Commit 9b56d0f

Browse files
committed
nas: fix subpath creation
Fix this error: stat /var/lib/kubelet/csi-plugins/nasplugin.csi.alibabacloud.com/node: no such file or directory Fixes: 31e4961
1 parent 785ff8b commit 9b56d0f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pkg/nas/utils.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,11 @@ func doMount(mounter mountutils.Interface, opt *Options, targetPath, volumeId, p
139139
}
140140
rootSource := fmt.Sprintf("%s:%s", opt.Server, rootPath)
141141
klog.Infof("trying to create subpath %s in %s", opt.Path, opt.Server)
142-
tmpPath, err := os.MkdirTemp(filepath.Join(utils.KubeletRootDir, "csi-plugins", driverName, "node"), "subpath-creation_"+volumeId+"_")
142+
tmpPath := filepath.Join(utils.KubeletRootDir, "csi-plugins", driverName, "node")
143+
if err := os.MkdirAll(tmpPath, 0o700); err != nil {
144+
return err
145+
}
146+
tmpPath, err = os.MkdirTemp(tmpPath, "subpath-creation_"+volumeId+"_")
143147
if err != nil {
144148
return err
145149
}

0 commit comments

Comments
 (0)