mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-30 10:10:21 +00:00
rbd: replace klog with util logger in rbd_attach.go
replace klog with util logger in rbd_attach.go
Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
(cherry picked from commit 9512aa6206
)
This commit is contained in:
parent
727666dedc
commit
f9bb13a373
@ -29,7 +29,6 @@ import (
|
|||||||
"github.com/ceph/ceph-csi/internal/util"
|
"github.com/ceph/ceph-csi/internal/util"
|
||||||
|
|
||||||
"k8s.io/apimachinery/pkg/util/wait"
|
"k8s.io/apimachinery/pkg/util/wait"
|
||||||
klog "k8s.io/klog/v2"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -132,7 +131,7 @@ func findDeviceMappingImage(ctx context.Context, pool, namespace, image string,
|
|||||||
|
|
||||||
rbdDeviceList, err := rbdGetDeviceList(ctx, accessType)
|
rbdDeviceList, err := rbdGetDeviceList(ctx, accessType)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
klog.Warningf(util.Log(ctx, "failed to determine if image (%s) is mapped to a device (%v)"), imageSpec, err)
|
util.WarningLog(ctx, "failed to determine if image (%s) is mapped to a device (%v)", imageSpec, err)
|
||||||
return "", false
|
return "", false
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -239,12 +238,12 @@ func createPath(ctx context.Context, volOpt *rbdVolume, cr *util.Credentials) (s
|
|||||||
// Execute map
|
// Execute map
|
||||||
stdout, stderr, err := util.ExecCommand(ctx, rbd, mapOptions...)
|
stdout, stderr, err := util.ExecCommand(ctx, rbd, mapOptions...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
klog.Warningf(util.Log(ctx, "rbd: map error %v, rbd output: %s"), err, stderr)
|
util.WarningLog(ctx, "rbd: map error %v, rbd output: %s", err, stderr)
|
||||||
// unmap rbd image if connection timeout
|
// unmap rbd image if connection timeout
|
||||||
if strings.Contains(err.Error(), rbdMapConnectionTimeout) {
|
if strings.Contains(err.Error(), rbdMapConnectionTimeout) {
|
||||||
detErr := detachRBDImageOrDeviceSpec(ctx, imagePath, true, isNbd, volOpt.Encrypted, volOpt.VolID)
|
detErr := detachRBDImageOrDeviceSpec(ctx, imagePath, true, isNbd, volOpt.Encrypted, volOpt.VolID)
|
||||||
if detErr != nil {
|
if detErr != nil {
|
||||||
klog.Warningf(util.Log(ctx, "rbd: %s unmap error %v"), imagePath, detErr)
|
util.WarningLog(ctx, "rbd: %s unmap error %v", imagePath, detErr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return "", fmt.Errorf("rbd: map failed with error %v, rbd error output: %s", err, stderr)
|
return "", fmt.Errorf("rbd: map failed with error %v, rbd error output: %s", err, stderr)
|
||||||
@ -292,7 +291,7 @@ func detachRBDImageOrDeviceSpec(ctx context.Context, imageOrDeviceSpec string, i
|
|||||||
mapperFile, mapperPath := util.VolumeMapper(volumeID)
|
mapperFile, mapperPath := util.VolumeMapper(volumeID)
|
||||||
mappedDevice, mapper, err := util.DeviceEncryptionStatus(ctx, mapperPath)
|
mappedDevice, mapper, err := util.DeviceEncryptionStatus(ctx, mapperPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
klog.Errorf(util.Log(ctx, "error determining LUKS device on %s, %s: %s"),
|
util.ErrorLog(ctx, "error determining LUKS device on %s, %s: %s",
|
||||||
mapperPath, imageOrDeviceSpec, err)
|
mapperPath, imageOrDeviceSpec, err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -300,7 +299,7 @@ func detachRBDImageOrDeviceSpec(ctx context.Context, imageOrDeviceSpec string, i
|
|||||||
// mapper found, so it is open Luks device
|
// mapper found, so it is open Luks device
|
||||||
err = util.CloseEncryptedVolume(ctx, mapperFile)
|
err = util.CloseEncryptedVolume(ctx, mapperFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
klog.Errorf(util.Log(ctx, "error closing LUKS device on %s, %s: %s"),
|
util.ErrorLog(ctx, "error closing LUKS device on %s, %s: %s",
|
||||||
mapperPath, imageOrDeviceSpec, err)
|
mapperPath, imageOrDeviceSpec, err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user