From 977a7467a26d2aa10f1ec45f46aba8f8c341a122 Mon Sep 17 00:00:00 2001 From: David Zhu Date: Fri, 24 Aug 2018 13:28:19 -0700 Subject: [PATCH] Don't fail when NodePublish or NodeStage on same target path multiple times, idempotency --- pkg/gce-pd-csi-driver/node.go | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/pkg/gce-pd-csi-driver/node.go b/pkg/gce-pd-csi-driver/node.go index 64df239d4..bcdd923bc 100644 --- a/pkg/gce-pd-csi-driver/node.go +++ b/pkg/gce-pd-csi-driver/node.go @@ -73,7 +73,13 @@ func (ns *GCENodeServer) NodePublishVolume(ctx context.Context, req *csi.NodePub } if !notMnt { // TODO(#95): check if mount is compatible. Return OK if it is, or appropriate error. - return nil, status.Error(codes.Unimplemented, "NodePublishVolume Mount point already exists, but cannot determine whether it is compatible or not") + /* + 1) Target Path MUST be the vol referenced by vol ID + 2) VolumeCapability MUST match + 3) Readonly MUST match + + */ + return &csi.NodePublishVolumeResponse{}, nil } if err := ns.Mounter.Interface.MakeDir(targetPath); err != nil { @@ -198,7 +204,13 @@ func (ns *GCENodeServer) NodeStageVolume(ctx context.Context, req *csi.NodeStage if !notMnt { // TODO(#95): Check who is mounted here. No error if its us - return nil, fmt.Errorf("already a mount point") + /* + 1) Target Path MUST be the vol referenced by vol ID + 2) VolumeCapability MUST match + 3) Readonly MUST match + + */ + return &csi.NodeStageVolumeResponse{}, nil }