Skip to content

Commit

Permalink
fix vhd format support
Browse files Browse the repository at this point in the history
closes  #47

Signed-off-by: Adphi <[email protected]>
  • Loading branch information
Adphi committed May 8, 2024
1 parent b27add5 commit 46952df
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion docs/content/reference/d2vm_build.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/content/reference/d2vm_convert.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 46952df

Please sign in to comment.