Skip to content

Commit 0dde51e

Browse files
committed
Apply reviews
- default.yaml: Fix comment placing - pkg/qemuimgutil: Change `QemuImageUtil.Convert` to returns error on specifying other than `raw.Type` Signed-off-by: Norio Nomura <[email protected]>
1 parent 81852d8 commit 0dde51e

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

pkg/qemuimgutil/qemuimgutil.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
"strconv"
1616

1717
"github.com/lima-vm/go-qcow2reader/image"
18+
"github.com/lima-vm/go-qcow2reader/image/raw"
1819
"github.com/sirupsen/logrus"
1920
)
2021

@@ -201,8 +202,11 @@ func GetInfo(ctx context.Context, path string) (*Info, error) {
201202
}
202203

203204
// Convert converts a disk image to raw format.
204-
// Specified imageType is ignored.
205-
func (q *QemuImageUtil) Convert(ctx context.Context, _ image.Type, source, dest string, size *int64, allowSourceWithBackingFile bool) error {
205+
// Currently only raw.Type is supported.
206+
func (q *QemuImageUtil) Convert(ctx context.Context, imageType image.Type, source, dest string, size *int64, allowSourceWithBackingFile bool) error {
207+
if imageType != raw.Type {
208+
return fmt.Errorf("QemuImageUtil.Convert only supports raw.Type, got %q", imageType)
209+
}
206210
if !allowSourceWithBackingFile {
207211
info, err := getInfo(ctx, source)
208212
if err != nil {

templates/default.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,11 +370,11 @@ vmOpts:
370370
# riscv64: "max" # (or "host" when running on riscv64 host)
371371
# x86_64: "max" # (or "host" when running on x86_64 host; additional options are appended on Intel Mac)
372372
vz:
373-
diskImageFormat: null
374373
# Specify the disk image format: "raw" or "asif".
375374
# Currently only applies to the primary disk image.
376375
# "asif" requires macOS 26+, and does not support converting back to "raw".
377376
# 🟢 Builtin default: "raw"
377+
diskImageFormat: null
378378
rosetta:
379379
# Enable Rosetta inside the VM; needs `vmType: vz`
380380
# Hint: try `softwareupdate --install-rosetta` if Lima gets stuck at `Installing rosetta...`

0 commit comments

Comments
 (0)