2
0
mirror of https://github.com/linka-cloud/d2vm.git synced 2024-11-22 07:46:25 +00:00

fix vhd format support

closes  #47

Signed-off-by: Adphi <philippe.adrien.nousse@gmail.com>
This commit is contained in:
Adphi 2024-05-08 16:48:38 +02:00 committed by Adphi
parent b27add5767
commit f711f8919d
3 changed files with 6 additions and 3 deletions

View File

@ -44,7 +44,7 @@ ff02::3 ip6-allhosts
perm os.FileMode = 0644 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 { type Builder interface {
Build(ctx context.Context) (err error) Build(ctx context.Context) (err error)
@ -113,6 +113,9 @@ func NewBuilder(ctx context.Context, workdir, imgTag, disk string, size uint64,
if !valid { if !valid {
return nil, fmt.Errorf("invalid format: %s valid formats are: %s", f, strings.Join(formats, " ")) return nil, fmt.Errorf("invalid format: %s valid formats are: %s", f, strings.Join(formats, " "))
} }
if f == "vhd" {
f = "vpc"
}
if splitBoot && bootSize < 50 { if splitBoot && bootSize < 50 {
return nil, fmt.Errorf("boot partition size must be at least 50MiB") return nil, fmt.Errorf("boot partition size must be at least 50MiB")

View File

@ -20,7 +20,7 @@ d2vm build [context directory] [flags]
--keep-cache Keep the images after the build --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 --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 --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 -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") --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 --pull Always pull docker image

View File

@ -18,7 +18,7 @@ d2vm convert [docker image] [flags]
--keep-cache Keep the images after the build --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 --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 --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 -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") --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 --pull Always pull docker image