cephfs: replace klog.Error with util.ErrorLog in createSnapshot

replace klog.Error with util.ErrorLog in createSnapshot
for context based logging.

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
Madhu Rajanna 2020-08-11 16:55:36 +05:30 committed by mergify[bot]
parent 81b52b311d
commit 5802265b28

View File

@ -449,13 +449,13 @@ func (cs *ControllerServer) CreateSnapshot(ctx context.Context, req *csi.CreateS
sourceVolID := req.GetSourceVolumeId()
// Existence and conflict checks
if acquired := cs.SnapshotLocks.TryAcquire(requestName); !acquired {
klog.Errorf(util.Log(ctx, util.SnapshotOperationAlreadyExistsFmt), requestName)
util.ErrorLog(ctx, util.SnapshotOperationAlreadyExistsFmt, requestName)
return nil, status.Errorf(codes.Aborted, util.SnapshotOperationAlreadyExistsFmt, requestName)
}
defer cs.SnapshotLocks.Release(requestName)
if err = cs.OperationLocks.GetSnapshotCreateLock(sourceVolID); err != nil {
klog.Error(util.Log(ctx, err.Error()))
util.ErrorLog(ctx, err.Error())
return nil, status.Error(codes.Aborted, err.Error())
}
@ -486,7 +486,7 @@ func (cs *ControllerServer) CreateSnapshot(ctx context.Context, req *csi.CreateS
// lock out parallel snapshot create operations
if acquired := cs.VolumeLocks.TryAcquire(sourceVolID); !acquired {
klog.Errorf(util.Log(ctx, util.VolumeOperationAlreadyExistsFmt), sourceVolID)
util.ErrorLog(ctx, util.VolumeOperationAlreadyExistsFmt, sourceVolID)
return nil, status.Errorf(codes.Aborted, util.VolumeOperationAlreadyExistsFmt, sourceVolID)
}
defer cs.VolumeLocks.Release(sourceVolID)