From 85960b6571a0189db57e265d525ab624ee17eec7 Mon Sep 17 00:00:00 2001 From: Madhu Rajanna Date: Mon, 16 Dec 2019 14:54:21 +0530 Subject: [PATCH] Add ID based logging for ExpandVolume Updated logging to log ReqID Fixes: #732 Signed-off-by: Madhu Rajanna --- pkg/cephfs/controllerserver.go | 6 +++--- pkg/rbd/controllerserver.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/cephfs/controllerserver.go b/pkg/cephfs/controllerserver.go index 64132b66d..1ffe41a27 100644 --- a/pkg/cephfs/controllerserver.go +++ b/pkg/cephfs/controllerserver.go @@ -296,7 +296,7 @@ func (cs *ControllerServer) ValidateVolumeCapabilities( // ExpandVolume expand CephFS Volumes on demand based on resizer request func (cs *ControllerServer) ControllerExpandVolume(ctx context.Context, req *csi.ControllerExpandVolumeRequest) (*csi.ControllerExpandVolumeResponse, error) { if err := cs.validateExpandVolumeRequest(req); err != nil { - klog.Errorf("ControllerExpandVolumeRequest validation failed: %v", err) + klog.Errorf(util.Log(ctx, "ControllerExpandVolumeRequest validation failed: %v"), err) return nil, err } @@ -319,14 +319,14 @@ func (cs *ControllerServer) ControllerExpandVolume(ctx context.Context, req *csi volOptions, volIdentifier, err := newVolumeOptionsFromVolID(ctx, volID, nil, secret) if err != nil { - klog.Errorf("validation and extraction of volume options failed: %v", err) + klog.Errorf(util.Log(ctx, "validation and extraction of volume options failed: %v"), err) return nil, status.Error(codes.InvalidArgument, err.Error()) } RoundOffSize := util.RoundOffBytes(req.GetCapacityRange().GetRequiredBytes()) if err = createVolume(ctx, volOptions, cr, volumeID(volIdentifier.FsSubvolName), RoundOffSize); err != nil { - klog.Errorf("failed to expand volume %s: %v", volumeID(volIdentifier.FsSubvolName), err) + klog.Errorf(util.Log(ctx, "failed to expand volume %s: %v"), volumeID(volIdentifier.FsSubvolName), err) return nil, status.Error(codes.Internal, err.Error()) } diff --git a/pkg/rbd/controllerserver.go b/pkg/rbd/controllerserver.go index 43e3a0d3e..ced03cc7c 100644 --- a/pkg/rbd/controllerserver.go +++ b/pkg/rbd/controllerserver.go @@ -668,7 +668,7 @@ func (cs *ControllerServer) DeleteSnapshot(ctx context.Context, req *csi.DeleteS // ControllerExpandVolume expand RBD Volumes on demand based on resizer request func (cs *ControllerServer) ControllerExpandVolume(ctx context.Context, req *csi.ControllerExpandVolumeRequest) (*csi.ControllerExpandVolumeResponse, error) { if err := cs.Driver.ValidateControllerServiceRequest(csi.ControllerServiceCapability_RPC_EXPAND_VOLUME); err != nil { - klog.Warningf("invalid expand volume req: %v", protosanitizer.StripSecrets(req)) + klog.Warningf(util.Log(ctx, "invalid expand volume req: %v"), protosanitizer.StripSecrets(req)) return nil, err }