From b0624790121f6fe2f3ba29b9ff797d873b21d5d3 Mon Sep 17 00:00:00 2001 From: Madhu Rajanna Date: Thu, 19 Oct 2023 09:53:34 +0200 Subject: [PATCH] util: remove unimplemented methods As we are using UnimplementedControllerServer we dont need to implement mock methods. Signed-off-by: Madhu Rajanna --- .../csi-common/controllerserver-default.go | 50 +------------------ internal/csi-common/identityserver-default.go | 2 +- internal/csi-common/nodeserver-default.go | 10 ---- 3 files changed, 2 insertions(+), 60 deletions(-) diff --git a/internal/csi-common/controllerserver-default.go b/internal/csi-common/controllerserver-default.go index a5b21f206..fcc261d78 100644 --- a/internal/csi-common/controllerserver-default.go +++ b/internal/csi-common/controllerserver-default.go @@ -28,40 +28,8 @@ import ( // DefaultControllerServer points to default driver. type DefaultControllerServer struct { - Driver *CSIDriver csi.UnimplementedControllerServer -} - -// ControllerPublishVolume publish volume on node. -func (cs *DefaultControllerServer) ControllerPublishVolume( - ctx context.Context, - req *csi.ControllerPublishVolumeRequest, -) (*csi.ControllerPublishVolumeResponse, error) { - return nil, status.Error(codes.Unimplemented, "") -} - -// ControllerUnpublishVolume unpublish on node. -func (cs *DefaultControllerServer) ControllerUnpublishVolume( - ctx context.Context, - req *csi.ControllerUnpublishVolumeRequest, -) (*csi.ControllerUnpublishVolumeResponse, error) { - return nil, status.Error(codes.Unimplemented, "") -} - -// ListVolumes lists volumes. -func (cs *DefaultControllerServer) ListVolumes( - ctx context.Context, - req *csi.ListVolumesRequest, -) (*csi.ListVolumesResponse, error) { - return nil, status.Error(codes.Unimplemented, "") -} - -// GetCapacity get volume capacity. -func (cs *DefaultControllerServer) GetCapacity( - ctx context.Context, - req *csi.GetCapacityRequest, -) (*csi.GetCapacityResponse, error) { - return nil, status.Error(codes.Unimplemented, "") + Driver *CSIDriver } // ControllerGetCapabilities implements the default GRPC callout. @@ -79,19 +47,3 @@ func (cs *DefaultControllerServer) ControllerGetCapabilities( Capabilities: cs.Driver.capabilities, }, nil } - -// ListSnapshots lists snapshots. -func (cs *DefaultControllerServer) ListSnapshots( - ctx context.Context, - req *csi.ListSnapshotsRequest, -) (*csi.ListSnapshotsResponse, error) { - return nil, status.Error(codes.Unimplemented, "") -} - -// ControllerGetVolume fetch volume information. -func (cs *DefaultControllerServer) ControllerGetVolume( - ctx context.Context, - req *csi.ControllerGetVolumeRequest, -) (*csi.ControllerGetVolumeResponse, error) { - return nil, status.Error(codes.Unimplemented, "") -} diff --git a/internal/csi-common/identityserver-default.go b/internal/csi-common/identityserver-default.go index 90f665908..92b92fb2c 100644 --- a/internal/csi-common/identityserver-default.go +++ b/internal/csi-common/identityserver-default.go @@ -28,8 +28,8 @@ import ( // DefaultIdentityServer stores driver object. type DefaultIdentityServer struct { - Driver *CSIDriver csi.UnimplementedControllerServer + Driver *CSIDriver } // GetPluginInfo returns plugin information. diff --git a/internal/csi-common/nodeserver-default.go b/internal/csi-common/nodeserver-default.go index 40206980d..4e6be24b2 100644 --- a/internal/csi-common/nodeserver-default.go +++ b/internal/csi-common/nodeserver-default.go @@ -22,8 +22,6 @@ import ( "github.com/ceph/ceph-csi/internal/util/log" "github.com/container-storage-interface/spec/lib/go/csi" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" mount "k8s.io/mount-utils" ) @@ -35,14 +33,6 @@ type DefaultNodeServer struct { Mounter mount.Interface } -// NodeExpandVolume returns unimplemented response. -func (ns *DefaultNodeServer) NodeExpandVolume( - ctx context.Context, - req *csi.NodeExpandVolumeRequest, -) (*csi.NodeExpandVolumeResponse, error) { - return nil, status.Error(codes.Unimplemented, "") -} - // NodeGetInfo returns node ID. func (ns *DefaultNodeServer) NodeGetInfo( ctx context.Context,