Skip to content

Commit

Permalink
decoupling enable symlink configuration with skip check mount ready c…
Browse files Browse the repository at this point in the history
…onfiguration (#4393)

Signed-off-by: jiuyu <[email protected]>
Co-authored-by: jiuyu <[email protected]>
  • Loading branch information
Syspretor and jiuyu authored Nov 7, 2024
1 parent 3db2a62 commit 3ad502b
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions pkg/csi/plugins/nodeserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,6 @@ func (ns *nodeServer) NodePublishVolume(ctx context.Context, req *csi.NodePublis
}

// 1. Wait the runtime fuse ready and check the sub path existence
useSymlink := useSymlink(req)

skipCheckMountReadyMountModeSelector, err := base.ParseMountModeSelectorFromStr(req.GetVolumeContext()[common.AnnotationSkipCheckMountReadyTarget])
if err != nil {
return nil, status.Error(codes.InvalidArgument, err.Error())
Expand All @@ -149,10 +147,7 @@ func (ns *nodeServer) NodePublishVolume(ctx context.Context, req *csi.NodePublis
if skipCheckMountReadyMountModeSelector.Selected(base.MountPodMountMode) {
// 1. only mountPod involved csi-plugin
// 2. skip check mount ready for mountPod, for the scenario that dataset.spec.mounts is nil
// 3. if check mount ready is skipped for mountPod, symlink is forced to use, avoiding that unPublishVolume error occurs
// 4. the existence of mountPath should be checked to avoid that target path is linked with a non-existent mountPath
useSymlink = true
// Wait for mountPath to be created by mountPod
// 3. the existence of mountPath should be checked to avoid that target path is linked with a non-existent mountPath
if err := checkMountPathExists(ctx, mountPath); err != nil {
return nil, status.Error(codes.Internal, err.Error())
}
Expand All @@ -164,7 +159,7 @@ func (ns *nodeServer) NodePublishVolume(ctx context.Context, req *csi.NodePublis
}

// use symlink
if useSymlink {
if useSymlink(req) {
if err := utils.CreateSymlink(targetPath, mountPath); err != nil {
return nil, err
}
Expand Down

0 comments on commit 3ad502b

Please sign in to comment.