From f711f8919dedcef792fc533e87034936b8b29cce Mon Sep 17 00:00:00 2001 From: Adphi Date: Wed, 8 May 2024 16:48:38 +0200 Subject: [PATCH] fix vhd format support closes #47 Signed-off-by: Adphi --- builder.go | 5 ++++- docs/content/reference/d2vm_build.md | 2 +- docs/content/reference/d2vm_convert.md | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/builder.go b/builder.go index 1f74e60..8c3fb87 100644 --- a/builder.go +++ b/builder.go @@ -44,7 +44,7 @@ ff02::3 ip6-allhosts perm os.FileMode = 0644 ) -var formats = []string{"qcow2", "qed", "raw", "vdi", "vhd", "vmdk"} +var formats = []string{"qcow2", "qed", "raw", "vdi", "vhd", "vhd", "vhdx", "vmdk"} type Builder interface { Build(ctx context.Context) (err error) @@ -113,6 +113,9 @@ func NewBuilder(ctx context.Context, workdir, imgTag, disk string, size uint64, if !valid { return nil, fmt.Errorf("invalid format: %s valid formats are: %s", f, strings.Join(formats, " ")) } + if f == "vhd" { + f = "vpc" + } if splitBoot && bootSize < 50 { return nil, fmt.Errorf("boot partition size must be at least 50MiB") diff --git a/docs/content/reference/d2vm_build.md b/docs/content/reference/d2vm_build.md index c2672cb..110eab7 100644 --- a/docs/content/reference/d2vm_build.md +++ b/docs/content/reference/d2vm_build.md @@ -20,7 +20,7 @@ d2vm build [context directory] [flags] --keep-cache Keep the images after the build --luks-password string Password to use for the LUKS encrypted root partition. If not set, the root partition will not be encrypted --network-manager string Network manager to use for the image: none, netplan, ifupdown - -o, --output string The output image, the extension determine the image format, raw will be used if none. Supported formats: qcow2 qed raw vdi vhd vmdk (default "disk0.qcow2") + -o, --output string The output image, the extension determine the image format, raw will be used if none. Supported formats: qcow2 qed raw vdi vhd vhd vhdx vmdk (default "disk0.qcow2") -p, --password string Optional root user password --platform string Platform to use for the container disk image, linux/arm64 and linux/arm64 are supported (default "linux/amd64") --pull Always pull docker image diff --git a/docs/content/reference/d2vm_convert.md b/docs/content/reference/d2vm_convert.md index f96307d..e143acb 100644 --- a/docs/content/reference/d2vm_convert.md +++ b/docs/content/reference/d2vm_convert.md @@ -18,7 +18,7 @@ d2vm convert [docker image] [flags] --keep-cache Keep the images after the build --luks-password string Password to use for the LUKS encrypted root partition. If not set, the root partition will not be encrypted --network-manager string Network manager to use for the image: none, netplan, ifupdown - -o, --output string The output image, the extension determine the image format, raw will be used if none. Supported formats: qcow2 qed raw vdi vhd vmdk (default "disk0.qcow2") + -o, --output string The output image, the extension determine the image format, raw will be used if none. Supported formats: qcow2 qed raw vdi vhd vhd vhdx vmdk (default "disk0.qcow2") -p, --password string Optional root user password --platform string Platform to use for the container disk image, linux/arm64 and linux/arm64 are supported (default "linux/amd64") --pull Always pull docker image