Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Format of outputted image does not correspond format specified in config #376

Open
DohouM opened this issue Dec 7, 2022 · 0 comments
Open

Comments

@DohouM
Copy link

DohouM commented Dec 7, 2022

Hello,

I am currently using windows-imaging-tools to create images for an Openstack infrastructure. However, I'm hitting a little quirk that proves to be annoying. I am trying to generate a MAAS image with a QCOW2 format, to prevent conversion from RAW to QCOW2 by the Nova service. However, the following lines in the script are preventing me from doing so :

if ($windowsImageConfig.image_type -eq "HYPER-V") {
$imagePathVhdx = $barePath + ".vhdx"
if ($imagePath -ne $imagePathVhdx) {
Move-Item -Force $imagePath $imagePathVhdx
$imagePath = $imagePathVhdx
}
}
if ($windowsImageConfig.image_type -eq "MAAS") {
$imagePathRaw = $barePath + ".raw"
Write-Log "Converting VHD to RAW"
Convert-VirtualDisk -vhdPath $imagePath -outPath $imagePathRaw `
-format "RAW"
Remove-Item -Force $imagePath
$imagePath = $imagePathRaw
}
if ($windowsImageConfig.image_type -eq "KVM") {
$imagePathQcow2 = $barePath + ".qcow2"
Write-Log "Converting VHD to QCow2"
Convert-VirtualDisk -vhdPath $imagePath -outPath $imagePathQcow2 `
-format "qcow2" -CompressQcow2 $windowsImageConfig.compress_qcow2
Remove-Item -Force $imagePath
$imagePath = $imagePathQcow2
}
if ($windowsImageConfig.image_type -eq "VMware") {
$imagePathVmdk = $barePath + ".vmdk"
Write-Log "Converting VHD to VMDK"
Convert-VirtualDisk -vhdPath $imagePath -outPath $imagePathVmdk `
-format "vmdk"
Remove-Item -Force $imagePath
$imagePath = $imagePathVmdk
}

Here's a snippet of my config :

...
# Select between VHD, VHDX, QCOW2, VMDK or RAW formats.
virtual_disk_format=QCOW2
# This parameter allows to choose between MAAS, KVM, VMware and Hyper-V specific images.
# For HYPER-V, cloudbase-init will be installed and the generated image should be in vhd or vhdx format.
# For MAAS, in addition to cloudbase-init, the curtin tools are installed
# and the generated image should be in raw.tgz format.
# For KVM, in addition to cloudbase-init, the VirtIO drivers are installed
# and the generated image should be in qcow2 format.
image_type=MAAS
...

A possible solution to this specific problem would be to add a new parameter, called force_virtual_disk_format, which would bypass this implicit conversion.

Thanks in advance for your response !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant