Replace aliased imports of logrus, fixes #11762
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
This commit is contained in:
parent
3b068ebe39
commit
18180bfabf
15 changed files with 80 additions and 80 deletions
|
@ -7,7 +7,7 @@ import (
|
|||
"os"
|
||||
"syscall"
|
||||
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/Sirupsen/logrus"
|
||||
)
|
||||
|
||||
func stringToLoopName(src string) [LoNameSize]uint8 {
|
||||
|
@ -39,20 +39,20 @@ func openNextAvailableLoopback(index int, sparseFile *os.File) (loopFile *os.Fil
|
|||
fi, err := os.Stat(target)
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
log.Errorf("There are no more loopback devices available.")
|
||||
logrus.Errorf("There are no more loopback devices available.")
|
||||
}
|
||||
return nil, ErrAttachLoopbackDevice
|
||||
}
|
||||
|
||||
if fi.Mode()&os.ModeDevice != os.ModeDevice {
|
||||
log.Errorf("Loopback device %s is not a block device.", target)
|
||||
logrus.Errorf("Loopback device %s is not a block device.", target)
|
||||
continue
|
||||
}
|
||||
|
||||
// OpenFile adds O_CLOEXEC
|
||||
loopFile, err = os.OpenFile(target, os.O_RDWR, 0644)
|
||||
if err != nil {
|
||||
log.Errorf("Error opening loopback device: %s", err)
|
||||
logrus.Errorf("Error opening loopback device: %s", err)
|
||||
return nil, ErrAttachLoopbackDevice
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ func openNextAvailableLoopback(index int, sparseFile *os.File) (loopFile *os.Fil
|
|||
|
||||
// If the error is EBUSY, then try the next loopback
|
||||
if err != syscall.EBUSY {
|
||||
log.Errorf("Cannot set up loopback device %s: %s", target, err)
|
||||
logrus.Errorf("Cannot set up loopback device %s: %s", target, err)
|
||||
return nil, ErrAttachLoopbackDevice
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,7 @@ func openNextAvailableLoopback(index int, sparseFile *os.File) (loopFile *os.Fil
|
|||
|
||||
// This can't happen, but let's be sure
|
||||
if loopFile == nil {
|
||||
log.Errorf("Unreachable code reached! Error attaching %s to a loopback device.", sparseFile.Name())
|
||||
logrus.Errorf("Unreachable code reached! Error attaching %s to a loopback device.", sparseFile.Name())
|
||||
return nil, ErrAttachLoopbackDevice
|
||||
}
|
||||
|
||||
|
@ -91,13 +91,13 @@ func AttachLoopDevice(sparseName string) (loop *os.File, err error) {
|
|||
// loopback from index 0.
|
||||
startIndex, err := getNextFreeLoopbackIndex()
|
||||
if err != nil {
|
||||
log.Debugf("Error retrieving the next available loopback: %s", err)
|
||||
logrus.Debugf("Error retrieving the next available loopback: %s", err)
|
||||
}
|
||||
|
||||
// OpenFile adds O_CLOEXEC
|
||||
sparseFile, err := os.OpenFile(sparseName, os.O_RDWR, 0644)
|
||||
if err != nil {
|
||||
log.Errorf("Error opening sparse file %s: %s", sparseName, err)
|
||||
logrus.Errorf("Error opening sparse file %s: %s", sparseName, err)
|
||||
return nil, ErrAttachLoopbackDevice
|
||||
}
|
||||
defer sparseFile.Close()
|
||||
|
@ -115,11 +115,11 @@ func AttachLoopDevice(sparseName string) (loop *os.File, err error) {
|
|||
}
|
||||
|
||||
if err := ioctlLoopSetStatus64(loopFile.Fd(), loopInfo); err != nil {
|
||||
log.Errorf("Cannot set up loopback device info: %s", err)
|
||||
logrus.Errorf("Cannot set up loopback device info: %s", err)
|
||||
|
||||
// If the call failed, then free the loopback device
|
||||
if err := ioctlLoopClrFd(loopFile.Fd()); err != nil {
|
||||
log.Errorf("Error while cleaning up the loopback device")
|
||||
logrus.Errorf("Error while cleaning up the loopback device")
|
||||
}
|
||||
loopFile.Close()
|
||||
return nil, ErrAttachLoopbackDevice
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
"runtime"
|
||||
"syscall"
|
||||
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/Sirupsen/logrus"
|
||||
)
|
||||
|
||||
type DevmapperLogger interface {
|
||||
|
@ -237,7 +237,7 @@ func (t *Task) GetNextTarget(next uintptr) (nextPtr uintptr, start uint64,
|
|||
func getLoopbackBackingFile(file *os.File) (uint64, uint64, error) {
|
||||
loopInfo, err := ioctlLoopGetStatus64(file.Fd())
|
||||
if err != nil {
|
||||
log.Errorf("Error get loopback backing file: %s", err)
|
||||
logrus.Errorf("Error get loopback backing file: %s", err)
|
||||
return 0, 0, ErrGetLoopbackBackingFile
|
||||
}
|
||||
return loopInfo.loDevice, loopInfo.loInode, nil
|
||||
|
@ -245,7 +245,7 @@ func getLoopbackBackingFile(file *os.File) (uint64, uint64, error) {
|
|||
|
||||
func LoopbackSetCapacity(file *os.File) error {
|
||||
if err := ioctlLoopSetCapacity(file.Fd(), 0); err != nil {
|
||||
log.Errorf("Error loopbackSetCapacity: %s", err)
|
||||
logrus.Errorf("Error loopbackSetCapacity: %s", err)
|
||||
return ErrLoopbackSetCapacity
|
||||
}
|
||||
return nil
|
||||
|
@ -285,7 +285,7 @@ func FindLoopDeviceFor(file *os.File) *os.File {
|
|||
|
||||
func UdevWait(cookie uint) error {
|
||||
if res := DmUdevWait(cookie); res != 1 {
|
||||
log.Debugf("Failed to wait on udev cookie %d", cookie)
|
||||
logrus.Debugf("Failed to wait on udev cookie %d", cookie)
|
||||
return ErrUdevWait
|
||||
}
|
||||
return nil
|
||||
|
@ -305,7 +305,7 @@ func LogInit(logger DevmapperLogger) {
|
|||
|
||||
func SetDevDir(dir string) error {
|
||||
if res := DmSetDevDir(dir); res != 1 {
|
||||
log.Debugf("Error dm_set_dev_dir")
|
||||
logrus.Debugf("Error dm_set_dev_dir")
|
||||
return ErrSetDevDir
|
||||
}
|
||||
return nil
|
||||
|
@ -348,8 +348,8 @@ func CookieSupported() bool {
|
|||
|
||||
// Useful helper for cleanup
|
||||
func RemoveDevice(name string) error {
|
||||
log.Debugf("[devmapper] RemoveDevice START(%s)", name)
|
||||
defer log.Debugf("[devmapper] RemoveDevice END(%s)", name)
|
||||
logrus.Debugf("[devmapper] RemoveDevice START(%s)", name)
|
||||
defer logrus.Debugf("[devmapper] RemoveDevice END(%s)", name)
|
||||
task, err := TaskCreateNamed(DeviceRemove, name)
|
||||
if task == nil {
|
||||
return err
|
||||
|
@ -375,7 +375,7 @@ func RemoveDevice(name string) error {
|
|||
func GetBlockDeviceSize(file *os.File) (uint64, error) {
|
||||
size, err := ioctlBlkGetSize64(file.Fd())
|
||||
if err != nil {
|
||||
log.Errorf("Error getblockdevicesize: %s", err)
|
||||
logrus.Errorf("Error getblockdevicesize: %s", err)
|
||||
return 0, ErrGetBlockSize
|
||||
}
|
||||
return uint64(size), nil
|
||||
|
@ -494,21 +494,21 @@ func GetDriverVersion() (string, error) {
|
|||
func GetStatus(name string) (uint64, uint64, string, string, error) {
|
||||
task, err := TaskCreateNamed(DeviceStatus, name)
|
||||
if task == nil {
|
||||
log.Debugf("GetStatus: Error TaskCreateNamed: %s", err)
|
||||
logrus.Debugf("GetStatus: Error TaskCreateNamed: %s", err)
|
||||
return 0, 0, "", "", err
|
||||
}
|
||||
if err := task.Run(); err != nil {
|
||||
log.Debugf("GetStatus: Error Run: %s", err)
|
||||
logrus.Debugf("GetStatus: Error Run: %s", err)
|
||||
return 0, 0, "", "", err
|
||||
}
|
||||
|
||||
devinfo, err := task.GetInfo()
|
||||
if err != nil {
|
||||
log.Debugf("GetStatus: Error GetInfo: %s", err)
|
||||
logrus.Debugf("GetStatus: Error GetInfo: %s", err)
|
||||
return 0, 0, "", "", err
|
||||
}
|
||||
if devinfo.Exists == 0 {
|
||||
log.Debugf("GetStatus: Non existing device %s", name)
|
||||
logrus.Debugf("GetStatus: Non existing device %s", name)
|
||||
return 0, 0, "", "", fmt.Errorf("Non existing device %s", name)
|
||||
}
|
||||
|
||||
|
@ -567,7 +567,7 @@ func ResumeDevice(name string) error {
|
|||
}
|
||||
|
||||
func CreateDevice(poolName string, deviceId int) error {
|
||||
log.Debugf("[devmapper] CreateDevice(poolName=%v, deviceId=%v)", poolName, deviceId)
|
||||
logrus.Debugf("[devmapper] CreateDevice(poolName=%v, deviceId=%v)", poolName, deviceId)
|
||||
task, err := TaskCreateNamed(DeviceTargetMsg, poolName)
|
||||
if task == nil {
|
||||
return err
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue