Skip to content

Commit 0dc6b49

Browse files
committed
fix: Add standardized logs to gRPC methods
1 parent a1ff2ea commit 0dc6b49

2 files changed

Lines changed: 18 additions & 4 deletions

File tree

pkg/rclone/controllerserver.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,18 +103,23 @@ func (cs *ControllerServer) ValidateVolumeCapabilities(_ context.Context, req *c
103103
}
104104

105105
// ControllerPublishVolume Attaching Volume
106-
func (cs *ControllerServer) ControllerPublishVolume(_ context.Context, _ *csi.ControllerPublishVolumeRequest) (*csi.ControllerPublishVolumeResponse, error) {
106+
func (cs *ControllerServer) ControllerPublishVolume(_ context.Context, req *csi.ControllerPublishVolumeRequest) (*csi.ControllerPublishVolumeResponse, error) {
107+
klog.Infof("ControllerPublishVolume called with: %v", *req)
108+
107109
return nil, status.Errorf(codes.Unimplemented, "method ControllerPublishVolume not implemented")
108110
}
109111

110112
// ControllerUnpublishVolume Detaching Volume
111-
func (cs *ControllerServer) ControllerUnpublishVolume(_ context.Context, _ *csi.ControllerUnpublishVolumeRequest) (*csi.ControllerUnpublishVolumeResponse, error) {
113+
func (cs *ControllerServer) ControllerUnpublishVolume(_ context.Context, req *csi.ControllerUnpublishVolumeRequest) (*csi.ControllerUnpublishVolumeResponse, error) {
114+
klog.Infof("ControllerUnpublishVolume called with: %v", *req)
115+
112116
return nil, status.Errorf(codes.Unimplemented, "method ControllerUnpublishVolume not implemented")
113117
}
114118

115119
// CreateVolume Provisioning Volumes
116120
func (cs *ControllerServer) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest) (*csi.CreateVolumeResponse, error) {
117-
klog.Infof("ControllerCreateVolume: called with args %+v", *req)
121+
klog.Infof("CreateVolume called with: %v", *req)
122+
118123
volumeName := req.GetName()
119124
if len(volumeName) == 0 {
120125
return nil, status.Error(codes.InvalidArgument, "CreateVolume name must be provided")
@@ -172,6 +177,8 @@ func (cs *ControllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol
172177
}
173178

174179
func (cs *ControllerServer) DeleteVolume(_ context.Context, req *csi.DeleteVolumeRequest) (*csi.DeleteVolumeResponse, error) {
180+
klog.Infof("DeleteVolume called with: %v", *req)
181+
175182
volId := req.GetVolumeId()
176183
if len(volId) == 0 {
177184
return nil, status.Error(codes.InvalidArgument, "DeleteVolume must be provided volume id")

pkg/rclone/nodeserver.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,8 @@ func getVolumeConfig(ctx context.Context, req *csi.NodeStageVolumeRequest) (*Mou
320320
}
321321

322322
func (ns *NodeServer) NodeStageVolume(ctx context.Context, req *csi.NodeStageVolumeRequest) (*csi.NodeStageVolumeResponse, error) {
323+
klog.Infof("NodeStageVolume called with: %v", *req)
324+
323325
if err := validateNodeStageVolumeRequest(req); err != nil {
324326
return nil, err
325327
}
@@ -371,6 +373,8 @@ func validateNodeUnstageVolumeRequest(req *csi.NodeUnstageVolumeRequest) error {
371373
}
372374

373375
func (ns *NodeServer) NodeUnstageVolume(ctx context.Context, req *csi.NodeUnstageVolumeRequest) (*csi.NodeUnstageVolumeResponse, error) {
376+
klog.Infof("NodeUnstageVolume called with: %v", *req)
377+
374378
if err := validateNodeUnstageVolumeRequest(req); err != nil {
375379
return nil, err
376380
}
@@ -422,6 +426,8 @@ func validateNodePublishVolumeRequest(req *csi.NodePublishVolumeRequest) error {
422426
}
423427

424428
func (ns *NodeServer) NodePublishVolume(_ context.Context, req *csi.NodePublishVolumeRequest) (*csi.NodePublishVolumeResponse, error) {
429+
klog.Infof("NodePublishVolume called with: %v", *req)
430+
425431
if err := validateNodePublishVolumeRequest(req); err != nil {
426432
return nil, err
427433
}
@@ -594,7 +600,8 @@ func extractConfigData(parameters map[string]string) (string, map[string]string)
594600

595601
// Unmounting Volumes
596602
func (ns *NodeServer) NodeUnpublishVolume(_ context.Context, req *csi.NodeUnpublishVolumeRequest) (*csi.NodeUnpublishVolumeResponse, error) {
597-
klog.Infof("NodeUnpublishVolume called with: %s", req)
603+
klog.Infof("NodeUnpublishVolume called with: %v", *req)
604+
598605
if err := validateUnPublishVolumeRequest(req); err != nil {
599606
return nil, err
600607
}

0 commit comments

Comments
 (0)