Skip to content

Commit 977a746

Browse files
committed
Don't fail when NodePublish or NodeStage on same target path multiple times, idempotency
1 parent d69d75e commit 977a746

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

pkg/gce-pd-csi-driver/node.go

+14-2
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,13 @@ func (ns *GCENodeServer) NodePublishVolume(ctx context.Context, req *csi.NodePub
7373
}
7474
if !notMnt {
7575
// TODO(#95): check if mount is compatible. Return OK if it is, or appropriate error.
76-
return nil, status.Error(codes.Unimplemented, "NodePublishVolume Mount point already exists, but cannot determine whether it is compatible or not")
76+
/*
77+
1) Target Path MUST be the vol referenced by vol ID
78+
2) VolumeCapability MUST match
79+
3) Readonly MUST match
80+
81+
*/
82+
return &csi.NodePublishVolumeResponse{}, nil
7783
}
7884

7985
if err := ns.Mounter.Interface.MakeDir(targetPath); err != nil {
@@ -198,7 +204,13 @@ func (ns *GCENodeServer) NodeStageVolume(ctx context.Context, req *csi.NodeStage
198204

199205
if !notMnt {
200206
// TODO(#95): Check who is mounted here. No error if its us
201-
return nil, fmt.Errorf("already a mount point")
207+
/*
208+
1) Target Path MUST be the vol referenced by vol ID
209+
2) VolumeCapability MUST match
210+
3) Readonly MUST match
211+
212+
*/
213+
return &csi.NodeStageVolumeResponse{}, nil
202214

203215
}
204216

0 commit comments

Comments
 (0)