From 24a66af3af14c0fa840eda36eafa84f5171c37d9 Mon Sep 17 00:00:00 2001 From: Niels de Vos Date: Mon, 20 Jan 2025 18:36:19 +0100 Subject: [PATCH] rbd: remove unused ControllerPublishVolume and ControllerUnpublishVolume The RBD ControllerService does not expose the `PUBLISH_UNPUBLISH_VOLUME` capability, so ControllerPublishVolume and ControllerUnpublishVolume will never get called. In case a broken Container Orchestrator does call these operations, a default Unimplemented error will be returned anyway. Signed-off-by: Niels de Vos --- internal/rbd/controllerserver.go | 33 -------------------------------- 1 file changed, 33 deletions(-) diff --git a/internal/rbd/controllerserver.go b/internal/rbd/controllerserver.go index 01338d7d2..dbcf59100 100644 --- a/internal/rbd/controllerserver.go +++ b/internal/rbd/controllerserver.go @@ -1600,36 +1600,3 @@ func (cs *ControllerServer) ControllerExpandVolume( NodeExpansionRequired: nodeExpansion, }, nil } - -// ControllerPublishVolume is a dummy publish implementation to mimic a successful attach operation being a NOOP. -func (cs *ControllerServer) ControllerPublishVolume( - ctx context.Context, - req *csi.ControllerPublishVolumeRequest, -) (*csi.ControllerPublishVolumeResponse, error) { - if req.GetVolumeId() == "" { - return nil, status.Error(codes.InvalidArgument, "Volume ID cannot be empty") - } - if req.GetNodeId() == "" { - return nil, status.Error(codes.InvalidArgument, "Node ID cannot be empty") - } - if req.GetVolumeCapability() == nil { - return nil, status.Error(codes.InvalidArgument, "Volume Capabilities cannot be empty") - } - - return &csi.ControllerPublishVolumeResponse{ - // the dummy response carry an empty map in its response. - PublishContext: map[string]string{}, - }, nil -} - -// ControllerUnPublishVolume is a dummy unpublish implementation to mimic a successful attach operation being a NOOP. -func (cs *ControllerServer) ControllerUnpublishVolume( - ctx context.Context, - req *csi.ControllerUnpublishVolumeRequest, -) (*csi.ControllerUnpublishVolumeResponse, error) { - if req.GetVolumeId() == "" { - return nil, status.Error(codes.InvalidArgument, "Volume ID cannot be empty") - } - - return &csi.ControllerUnpublishVolumeResponse{}, nil -}