cephfs: replace klog.Warning with util.WarningLog in CreateVolume

replace klog.Warning with util.WarningLog in CreateVolume
for context based logging.

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
Madhu Rajanna 2020-08-11 17:06:42 +05:30 committed by mergify[bot]
parent 3d12456493
commit e3c3bbf0e3

View File

@ -147,7 +147,7 @@ func (cs *ControllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol
// Existence and conflict checks // Existence and conflict checks
if acquired := cs.VolumeLocks.TryAcquire(requestName); !acquired { if acquired := cs.VolumeLocks.TryAcquire(requestName); !acquired {
klog.Errorf(util.Log(ctx, util.VolumeOperationAlreadyExistsFmt), requestName) util.ErrorLog(ctx, util.VolumeOperationAlreadyExistsFmt, requestName)
return nil, status.Errorf(codes.Aborted, util.VolumeOperationAlreadyExistsFmt, requestName) return nil, status.Errorf(codes.Aborted, util.VolumeOperationAlreadyExistsFmt, requestName)
} }
defer cs.VolumeLocks.Release(requestName) defer cs.VolumeLocks.Release(requestName)
@ -193,7 +193,7 @@ func (cs *ControllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol
} }
errUndo := undoVolReservation(ctx, volOptions, *vID, secret) errUndo := undoVolReservation(ctx, volOptions, *vID, secret)
if errUndo != nil { if errUndo != nil {
klog.Warningf(util.Log(ctx, "failed undoing reservation of volume: %s (%s)"), util.WarningLog(ctx, "failed undoing reservation of volume: %s (%s)",
requestName, errUndo) requestName, errUndo)
} }
util.ErrorLog(ctx, "failed to expand volume %s: %v", volumeID(vID.FsSubvolName), err) util.ErrorLog(ctx, "failed to expand volume %s: %v", volumeID(vID.FsSubvolName), err)
@ -230,7 +230,7 @@ func (cs *ControllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol
if !errors.Is(err, ErrCloneInProgress) { if !errors.Is(err, ErrCloneInProgress) {
errDefer := undoVolReservation(ctx, volOptions, *vID, secret) errDefer := undoVolReservation(ctx, volOptions, *vID, secret)
if errDefer != nil { if errDefer != nil {
klog.Warningf(util.Log(ctx, "failed undoing reservation of volume: %s (%s)"), util.WarningLog(ctx, "failed undoing reservation of volume: %s (%s)",
requestName, errDefer) requestName, errDefer)
} }
} }