MCPcopy
hub / github.com/lima-vm/lima / Convert

Method Convert

pkg/imgutil/proxyimgutil/proxyimgutil.go:60–72  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

58// Convert converts a disk image to the specified format.
59// Currently supported formats are raw.Type and asif.Type.
60func (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
74func (p *ImageDiskManager) MakeSparse(ctx context.Context, f *os.File, offset int64) error {
75 err := p.qemu.MakeSparse(ctx, f, offset)

Callers

nothing calls this directly

Implementers 3

NativeImageUtilpkg/imgutil/nativeimgutil/nativeimguti
ImageDiskManagerpkg/imgutil/proxyimgutil/proxyimgutil.
QemuImageUtilpkg/qemuimgutil/qemuimgutil.go

Calls 1

ConvertMethod · 0.65

Tested by

no test coverage detected