mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-17 20:00:23 +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
|
var err error
|
||||||
if sID != nil {
|
if sID != nil {
|
||||||
if err = cs.OperationLocks.GetRestoreLock(sID.SnapshotID); err != 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())
|
return status.Error(codes.Aborted, err.Error())
|
||||||
}
|
}
|
||||||
defer cs.OperationLocks.ReleaseRestoreLock(sID.SnapshotID)
|
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) {
|
if errors.Is(err, rados.ErrObjectExists) {
|
||||||
return JoinErrors(ErrObjectExists, err)
|
return JoinErrors(ErrObjectExists, err)
|
||||||
} else if err != nil {
|
} 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
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -180,7 +180,7 @@ func RemoveObject(ctx context.Context, monitors string, cr *Credentials, poolNam
|
|||||||
if errors.Is(err, rados.ErrNotFound) {
|
if errors.Is(err, rados.ErrNotFound) {
|
||||||
return JoinErrors(ErrObjectNotFound, err)
|
return JoinErrors(ErrObjectNotFound, err)
|
||||||
} else if err != nil {
|
} 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
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,7 +158,7 @@ func GetCryptoPassphrase(ctx context.Context, volumeID string, kms EncryptionKMS
|
|||||||
}
|
}
|
||||||
return passphrase, nil
|
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
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -253,6 +253,6 @@ func (ol *OperationLock) release(op operation, volumeID string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
default:
|
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)
|
klog.FatalDepth(1, logMessage)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ErrorLog helps in logging errors.
|
// ErrorLogMsg helps in logging errors with message.
|
||||||
func ErrorLog(message string, args ...interface{}) {
|
func ErrorLogMsg(message string, args ...interface{}) {
|
||||||
logMessage := fmt.Sprintf(message, args...)
|
logMessage := fmt.Sprintf(message, args...)
|
||||||
klog.ErrorDepth(1, logMessage)
|
klog.ErrorDepth(1, logMessage)
|
||||||
}
|
}
|
||||||
|
@ -173,12 +173,12 @@ func CheckKernelSupport(release string, supportedVersions []KernelVersion) bool
|
|||||||
vers := strings.Split(strings.SplitN(release, "-", 2)[0], ".")
|
vers := strings.Split(strings.SplitN(release, "-", 2)[0], ".")
|
||||||
version, err := strconv.Atoi(vers[0])
|
version, err := strconv.Atoi(vers[0])
|
||||||
if err != nil {
|
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
|
return false
|
||||||
}
|
}
|
||||||
patchlevel, err := strconv.Atoi(vers[1])
|
patchlevel, err := strconv.Atoi(vers[1])
|
||||||
if err != nil {
|
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
|
return false
|
||||||
}
|
}
|
||||||
sublevel := 0
|
sublevel := 0
|
||||||
@ -186,7 +186,7 @@ func CheckKernelSupport(release string, supportedVersions []KernelVersion) bool
|
|||||||
if len(vers) >= minLenForSublvl {
|
if len(vers) >= minLenForSublvl {
|
||||||
sublevel, err = strconv.Atoi(vers[2])
|
sublevel, err = strconv.Atoi(vers[2])
|
||||||
if err != nil {
|
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
|
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
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user