mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-12-18 02:50:30 +00:00
util: rename ErrorLog to ErrorLogMsg to parity
as we have 2 functions for logging. one for logging with message and another one is for logging with context. renamed ErrorLog to ErrorLogMsg to log with messages. Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
parent
d4186a6880
commit
9229e84a77
@ -61,7 +61,7 @@ func (cs *ControllerServer) createBackingVolume(
|
||||
var err error
|
||||
if sID != nil {
|
||||
if err = cs.OperationLocks.GetRestoreLock(sID.SnapshotID); err != nil {
|
||||
klog.Error(util.Log(ctx, err.Error()))
|
||||
util.ErrorLog(util.Log(ctx, err.Error()))
|
||||
return status.Error(codes.Aborted, err.Error())
|
||||
}
|
||||
defer cs.OperationLocks.ReleaseRestoreLock(sID.SnapshotID)
|
||||
|
@ -146,7 +146,7 @@ func CreateObject(ctx context.Context, monitors string, cr *Credentials, poolNam
|
||||
if errors.Is(err, rados.ErrObjectExists) {
|
||||
return JoinErrors(ErrObjectExists, err)
|
||||
} else if err != nil {
|
||||
ErrorLog(Log(ctx, "failed creating omap (%s) in pool (%s): (%v)"), objectName, poolName, err)
|
||||
ErrorLogMsg(Log(ctx, "failed creating omap (%s) in pool (%s): (%v)"), objectName, poolName, err)
|
||||
return err
|
||||
}
|
||||
|
||||
@ -180,7 +180,7 @@ func RemoveObject(ctx context.Context, monitors string, cr *Credentials, poolNam
|
||||
if errors.Is(err, rados.ErrNotFound) {
|
||||
return JoinErrors(ErrObjectNotFound, err)
|
||||
} else if err != nil {
|
||||
ErrorLog(Log(ctx, "failed removing omap (%s) in pool (%s): (%v)"), oMapName, poolName, err)
|
||||
ErrorLogMsg(Log(ctx, "failed removing omap (%s) in pool (%s): (%v)"), oMapName, poolName, err)
|
||||
return err
|
||||
}
|
||||
|
||||
|
@ -158,7 +158,7 @@ func GetCryptoPassphrase(ctx context.Context, volumeID string, kms EncryptionKMS
|
||||
}
|
||||
return passphrase, nil
|
||||
}
|
||||
ErrorLog(Log(ctx, "failed to get encryption passphrase for %s: %s"), volumeID, err)
|
||||
ErrorLogMsg(Log(ctx, "failed to get encryption passphrase for %s: %s"), volumeID, err)
|
||||
return "", err
|
||||
}
|
||||
|
||||
|
@ -253,6 +253,6 @@ func (ol *OperationLock) release(op operation, volumeID string) {
|
||||
}
|
||||
}
|
||||
default:
|
||||
ErrorLog("%v operation not supported", op)
|
||||
ErrorLogMsg("%v operation not supported", op)
|
||||
}
|
||||
}
|
||||
|
@ -58,8 +58,8 @@ func FatalLog(message string, args ...interface{}) {
|
||||
klog.FatalDepth(1, logMessage)
|
||||
}
|
||||
|
||||
// ErrorLog helps in logging errors.
|
||||
func ErrorLog(message string, args ...interface{}) {
|
||||
// ErrorLogMsg helps in logging errors with message.
|
||||
func ErrorLogMsg(message string, args ...interface{}) {
|
||||
logMessage := fmt.Sprintf(message, args...)
|
||||
klog.ErrorDepth(1, logMessage)
|
||||
}
|
||||
|
@ -173,12 +173,12 @@ func CheckKernelSupport(release string, supportedVersions []KernelVersion) bool
|
||||
vers := strings.Split(strings.SplitN(release, "-", 2)[0], ".")
|
||||
version, err := strconv.Atoi(vers[0])
|
||||
if err != nil {
|
||||
ErrorLog("failed to parse version from %s: %v", release, err)
|
||||
ErrorLogMsg("failed to parse version from %s: %v", release, err)
|
||||
return false
|
||||
}
|
||||
patchlevel, err := strconv.Atoi(vers[1])
|
||||
if err != nil {
|
||||
ErrorLog("failed to parse patchlevel from %s: %v", release, err)
|
||||
ErrorLogMsg("failed to parse patchlevel from %s: %v", release, err)
|
||||
return false
|
||||
}
|
||||
sublevel := 0
|
||||
@ -186,7 +186,7 @@ func CheckKernelSupport(release string, supportedVersions []KernelVersion) bool
|
||||
if len(vers) >= minLenForSublvl {
|
||||
sublevel, err = strconv.Atoi(vers[2])
|
||||
if err != nil {
|
||||
ErrorLog("failed to parse sublevel from %s: %v", release, err)
|
||||
ErrorLogMsg("failed to parse sublevel from %s: %v", release, err)
|
||||
return false
|
||||
}
|
||||
}
|
||||
@ -223,7 +223,7 @@ func CheckKernelSupport(release string, supportedVersions []KernelVersion) bool
|
||||
}
|
||||
}
|
||||
}
|
||||
ErrorLog("kernel %s does not support required features", release)
|
||||
ErrorLogMsg("kernel %s does not support required features", release)
|
||||
return false
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user