Skip to content

Commit 2fb72d1

Browse files
author
Shuo Wu
committed
csi: Remove NOT_FOUND error from ControllerUnpublishVolume() implementation
Now the provisioner won't wait for Detach (ControllerUnpublishVolume()) complete before invoking DeleteVolume. Then Detach will get stuck in the NOT_FOUND error since there is no way to verify the volume before detaching. For the details, See container-storage-interface/spec#382 And the spec doc has removed NOT_FOUND error for ControllerUnpublishVolume(): https://github.com/container-storage-interface/spec/blob/release-1.2/spec.md#controllerunpublishvolume Signed-off-by: Shuo Wu <[email protected]>
1 parent c437ca0 commit 2fb72d1

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

csi/controller_server.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,11 +225,15 @@ func (cs *ControllerServer) ControllerUnpublishVolume(ctx context.Context, req *
225225
if err != nil {
226226
return nil, status.Error(codes.Internal, err.Error())
227227
}
228+
229+
// VOLUME_NOT_FOUND is no longer the ControllerUnpublishVolume error
230+
// See https://github.com/container-storage-interface/spec/issues/382 for details
228231
if existVol == nil {
229232
msg := fmt.Sprintf("ControllerUnpublishVolume: the volume %s not exists", req.GetVolumeId())
230233
logrus.Warn(msg)
231-
return nil, status.Error(codes.NotFound, msg)
234+
return &csi.ControllerUnpublishVolumeResponse{}, nil
232235
}
236+
233237
if existVol.State == string(types.VolumeStateDetaching) {
234238
return nil, status.Errorf(codes.Aborted, "The volume %s is detaching", req.GetVolumeId())
235239
}

0 commit comments

Comments
 (0)