Skip to content

Commit 90aa190

Browse files
Praveenrajmaniwlan0
authored andcommitted
Respond with appropriate error code in NodePublishVolume
if the NodePublishVolume is called prematurely, respond with proper error code to indicate NodeStage has not been completed yet From the csi spec :- ``` FAILED_PRECONDITION :: Caller MUST make sure call to NodeStageVolume is made and returns success before retrying with valid staging_target_path. ```
1 parent b6ca91c commit 90aa190

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pkg/node/publish_unpublish.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ func (n *NodeServer) NodePublishVolume(ctx context.Context, req *csi.NodePublish
9595

9696
// If not staged
9797
if vol.Status.StagingPath != stagingTargetPath {
98-
return nil, status.Error(codes.Internal, "cannot publish volume that hasn't been staged")
98+
return nil, status.Error(codes.FailedPrecondition, "cannot publish volume that hasn't been staged")
9999
}
100100

101101
extractPodLabels := func() map[string]string {

0 commit comments

Comments
 (0)