mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-25 15:50:20 +00:00
rbd: replace klog with util logger in rbd_journal.go
replace klog with util logger in rbd_journal.go Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
parent
9512aa6206
commit
90cc5a4fd0
@ -22,8 +22,6 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/ceph/ceph-csi/internal/util"
|
"github.com/ceph/ceph-csi/internal/util"
|
||||||
|
|
||||||
klog "k8s.io/klog/v2"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func validateNonEmptyField(field, fieldName, structName string) error {
|
func validateNonEmptyField(field, fieldName, structName string) error {
|
||||||
@ -155,7 +153,7 @@ func checkSnapCloneExists(ctx context.Context, parentVol *rbdVolume, rbdSnap *rb
|
|||||||
err = parentVol.deleteSnapshot(ctx, rbdSnap)
|
err = parentVol.deleteSnapshot(ctx, rbdSnap)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if !errors.Is(err, ErrSnapNotFound) {
|
if !errors.Is(err, ErrSnapNotFound) {
|
||||||
klog.Errorf(util.Log(ctx, "failed to delete snapshot %s: %v"), rbdSnap, err)
|
util.ErrorLog(ctx, "failed to delete snapshot %s: %v", rbdSnap, err)
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -184,7 +182,7 @@ func checkSnapCloneExists(ctx context.Context, parentVol *rbdVolume, rbdSnap *rb
|
|||||||
// create snapshot
|
// create snapshot
|
||||||
sErr := vol.createSnapshot(ctx, rbdSnap)
|
sErr := vol.createSnapshot(ctx, rbdSnap)
|
||||||
if sErr != nil {
|
if sErr != nil {
|
||||||
klog.Errorf(util.Log(ctx, "failed to create snapshot %s: %v"), rbdSnap, sErr)
|
util.ErrorLog(ctx, "failed to create snapshot %s: %v", rbdSnap, sErr)
|
||||||
err = undoSnapshotCloning(ctx, vol, rbdSnap, vol, cr)
|
err = undoSnapshotCloning(ctx, vol, rbdSnap, vol, cr)
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
@ -196,13 +194,13 @@ func checkSnapCloneExists(ctx context.Context, parentVol *rbdVolume, rbdSnap *rb
|
|||||||
if vol.ImageID == "" {
|
if vol.ImageID == "" {
|
||||||
sErr := vol.getImageID()
|
sErr := vol.getImageID()
|
||||||
if sErr != nil {
|
if sErr != nil {
|
||||||
klog.Errorf(util.Log(ctx, "failed to get image id %s: %v"), vol, sErr)
|
util.ErrorLog(ctx, "failed to get image id %s: %v", vol, sErr)
|
||||||
err = undoSnapshotCloning(ctx, vol, rbdSnap, vol, cr)
|
err = undoSnapshotCloning(ctx, vol, rbdSnap, vol, cr)
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
sErr = j.StoreImageID(ctx, vol.JournalPool, vol.ReservedID, vol.ImageID, cr)
|
sErr = j.StoreImageID(ctx, vol.JournalPool, vol.ReservedID, vol.ImageID, cr)
|
||||||
if sErr != nil {
|
if sErr != nil {
|
||||||
klog.Errorf(util.Log(ctx, "failed to store volume id %s: %v"), vol, sErr)
|
util.ErrorLog(ctx, "failed to store volume id %s: %v", vol, sErr)
|
||||||
err = undoSnapshotCloning(ctx, vol, rbdSnap, vol, cr)
|
err = undoSnapshotCloning(ctx, vol, rbdSnap, vol, cr)
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
@ -299,17 +297,17 @@ func (rv *rbdVolume) Exists(ctx context.Context, parentVol *rbdVolume) (bool, er
|
|||||||
if rv.ImageID == "" {
|
if rv.ImageID == "" {
|
||||||
err = rv.getImageID()
|
err = rv.getImageID()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
klog.Errorf(util.Log(ctx, "failed to get image id %s: %v"), rv, err)
|
util.ErrorLog(ctx, "failed to get image id %s: %v", rv, err)
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
err = j.StoreImageID(ctx, rv.JournalPool, rv.ReservedID, rv.ImageID, rv.conn.Creds)
|
err = j.StoreImageID(ctx, rv.JournalPool, rv.ReservedID, rv.ImageID, rv.conn.Creds)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
klog.Errorf(util.Log(ctx, "failed to store volume id %s: %v"), rv, err)
|
util.ErrorLog(ctx, "failed to store volume id %s: %v", rv, err)
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
klog.Errorf(util.Log(ctx, "failed to get stored image id: %v"), err)
|
util.ErrorLog(ctx, "failed to get stored image id: %v", err)
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user