فهرست منبع

Fix several btrfs driver error messages

Several of the error messages were wrong, but not one of them was helpful, so this fixes them to include the important information (the actual error), and a correct description of which operation failed.

Docker-DCO-1.1-Signed-off-by: Andrew Page <admwiggin@gmail.com> (github: tianon)
Tianon Gravi 11 سال پیش
والد
کامیت
f7f8e3c2b3
1فایلهای تغییر یافته به همراه3 افزوده شده و 3 حذف شده
  1. 3 3
      graphdriver/btrfs/btrfs.go

+ 3 - 3
graphdriver/btrfs/btrfs.go

@@ -99,7 +99,7 @@ func subvolCreate(path, name string) error {
 	_, _, errno := syscall.Syscall(syscall.SYS_IOCTL, getDirFd(dir), C.BTRFS_IOC_SUBVOL_CREATE,
 	_, _, errno := syscall.Syscall(syscall.SYS_IOCTL, getDirFd(dir), C.BTRFS_IOC_SUBVOL_CREATE,
 		uintptr(unsafe.Pointer(&args)))
 		uintptr(unsafe.Pointer(&args)))
 	if errno != 0 {
 	if errno != 0 {
-		return fmt.Errorf("Can't create subvolume")
+		return fmt.Errorf("Failed to create btrfs subvolume: %v", errno.Error())
 	}
 	}
 	return nil
 	return nil
 }
 }
@@ -126,7 +126,7 @@ func subvolSnapshot(src, dest, name string) error {
 	_, _, errno := syscall.Syscall(syscall.SYS_IOCTL, getDirFd(destDir), C.BTRFS_IOC_SNAP_CREATE_V2,
 	_, _, errno := syscall.Syscall(syscall.SYS_IOCTL, getDirFd(destDir), C.BTRFS_IOC_SNAP_CREATE_V2,
 		uintptr(unsafe.Pointer(&args)))
 		uintptr(unsafe.Pointer(&args)))
 	if errno != 0 {
 	if errno != 0 {
-		return fmt.Errorf("Can't create subvolume")
+		return fmt.Errorf("Failed to create btrfs snapshot: %v", errno.Error())
 	}
 	}
 	return nil
 	return nil
 }
 }
@@ -146,7 +146,7 @@ func subvolDelete(path, name string) error {
 	_, _, errno := syscall.Syscall(syscall.SYS_IOCTL, getDirFd(dir), C.BTRFS_IOC_SNAP_DESTROY,
 	_, _, errno := syscall.Syscall(syscall.SYS_IOCTL, getDirFd(dir), C.BTRFS_IOC_SNAP_DESTROY,
 		uintptr(unsafe.Pointer(&args)))
 		uintptr(unsafe.Pointer(&args)))
 	if errno != 0 {
 	if errno != 0 {
-		return fmt.Errorf("Can't create subvolume")
+		return fmt.Errorf("Failed to destroy btrfs snapshot: %v", errno.Error())
 	}
 	}
 	return nil
 	return nil
 }
 }