-
Notifications
You must be signed in to change notification settings - Fork 755
Closed
Labels
Description
Lines 64 to 82 in 1f787fb
| // inspectDisk attempts to inspect the disk size and format by itself, | |
| // and falls back to inspectDiskWithQemuImg on an error. | |
| func inspectDisk(fName string) (size int64, format string, _ error) { | |
| f, err := os.Open(fName) | |
| if err != nil { | |
| return inspectDiskWithQemuImg(fName) | |
| } | |
| defer f.Close() | |
| img, err := qcow2reader.Open(f) | |
| if err != nil { | |
| return inspectDiskWithQemuImg(fName) | |
| } | |
| sz := img.Size() | |
| if sz < 0 { | |
| return inspectDiskWithQemuImg(fName) | |
| } | |
| return sz, string(img.Type()), nil | |
| } |
go-qcow2reader should suffice to inspect the disk size.
I don't remember why I added inspectDiskSizeWithQemuImg fall-back in 20c2224 . Probably go-qcow2reader was immature at that time