Skip to content

Commit

Permalink
rbd: remove unused ControllerPublishVolume and ControllerUnpublishVolume
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
nixpanic committed Feb 4, 2025
1 parent 045768c commit 6d8882f
Showing 1 changed file with 0 additions and 33 deletions.
33 changes: 0 additions & 33 deletions internal/rbd/controllerserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -1599,36 +1599,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
}

0 comments on commit 6d8882f

Please sign in to comment.