Convert converts a disk image to the specified format. Currently supported formats are raw.Type and asif.Type.
(ctx context.Context, imageType image.Type, source, dest string, size *int64, allowSourceWithBackingFile bool)
| 58 | // Convert converts a disk image to the specified format. |
| 59 | // Currently supported formats are raw.Type and asif.Type. |
| 60 | func (p *ImageDiskManager) Convert(ctx context.Context, imageType image.Type, source, dest string, size *int64, allowSourceWithBackingFile bool) error { |
| 61 | if imageType == raw.Type { |
| 62 | err := p.qemu.Convert(ctx, imageType, source, dest, size, allowSourceWithBackingFile) |
| 63 | if err == nil { |
| 64 | return nil |
| 65 | } |
| 66 | if errors.Is(err, exec.ErrNotFound) { |
| 67 | return p.native.Convert(ctx, imageType, source, dest, size, allowSourceWithBackingFile) |
| 68 | } |
| 69 | return err |
| 70 | } |
| 71 | return p.native.Convert(ctx, imageType, source, dest, size, allowSourceWithBackingFile) |
| 72 | } |
| 73 | |
| 74 | func (p *ImageDiskManager) MakeSparse(ctx context.Context, f *os.File, offset int64) error { |
| 75 | err := p.qemu.MakeSparse(ctx, f, offset) |
nothing calls this directly
no test coverage detected