cloudbase / windows-imaging-tools

Tools to automate the creation of a Windows image for OpenStack, supporting KVM, Hyper-V, ESXi and more.
Apache License 2.0
680 stars 227 forks source link

Impossible to convert vhdx file in raw format during create-windows-online-cloud-image.ps1 process #387

Open reckful666 opened 9 months ago

reckful666 commented 9 months ago

Hi,

I try to generate windows 11 Pro image for openstack platform.

I already tried to generate a qcow2 image with create-windows-online-cloud-image.ps1 script but the server creation with this image failed in openstack. (too many attempts)

Now, I try to generate a raw file with the create-windows-online-cloud-image.ps1 script, but at the end process, it fails too

18/12/2023 15:10:06 - Could not retrieve VM runtime logs
18/12/2023 15:10:07 - Could not retrieve VM runtime logs
18/12/2023 15:10:08 - Could not retrieve VM runtime logs
18/12/2023 15:10:09 - Could not retrieve VM runtime logs
18/12/2023 15:10:10 - Could not retrieve VM runtime logs
18/12/2023 15:10:11 - Shrinking VHD to minimum size
18/12/2023 15:10:11 - Initial VHD size is: 30 GB
18/12/2023 15:10:17 - Current partition size: 29.998046875 GB
18/12/2023 15:10:17 - New partition size: 21 GB
18/12/2023 15:10:17 - Size increased: 22548578304
18/12/2023 15:10:19 - Final disk size: 21.001953125 GB
18/12/2023 15:10:22 - Converting VHD to RAW
18/12/2023 15:10:22 - Convert Virtual Disk: C:\Users\micka\windows-openstack-imaging-tools\Windows_11_Pro_23H2.vhdx...
18/12/2023 15:10:22 - Converting virtual disk image from C:\Users\micka\windows-openstack-imaging-tools\Windows_11_Pro_23H2.vhdx to C:\Users\micka\windows-openstack-imaging-tools\Windows_11_Pro_23H2.raw...
AVERTISSEMENT : Failed to run: C:\Users\micka\windows-openstack-imaging-tools\bin\qemu-img.exe convert -O raw C:\Users\micka\windows-openstack-imaging-tools\Windows_11_Pro_23H2.vhdx C:\Users\micka\windows-openstack-imaging-tools\Windows_11_Pro_23H2.raw
AVERTISSEMENT : Failed to run: C:\Users\micka\windows-openstack-imaging-tools\bin\qemu-img.exe convert -O raw C:\Users\micka\windows-openstack-imaging-tools\Windows_11_Pro_23H2.vhdx C:\Users\micka\windows-openstack-imaging-tools\Windows_11_Pro_23H2.raw
AVERTISSEMENT : Failed to run: C:\Users\micka\windows-openstack-imaging-tools\bin\qemu-img.exe convert -O raw C:\Users\micka\windows-openstack-imaging-tools\Windows_11_Pro_23H2.vhdx C:\Users\micka\windows-openstack-imaging-tools\Windows_11_Pro_23H2.raw
18/12/2023 15:10:35 - Failed to run: C:\Users\micka\windows-openstack-imaging-tools\bin\qemu-img.exe convert -O raw C:\Users\micka\windows-openstack-imaging-tools\Windows_11_Pro_23H2.vhdx C:\Users\micka\windows-openstack-imaging-tools\Windows_11_Pro_23H2.raw
Failed to run: C:\Users\micka\windows-openstack-imaging-tools\bin\qemu-img.exe convert -O raw C:\Users\micka\windows-openstack-imaging-tools\Windows_11_Pro_23H2.vhdx C:\Users\micka\windows-openstack-imaging-tools\Windows_11_Pro_23H2.raw
Au caractère C:\Users\micka\windows-openstack-imaging-tools\WinImageBuilder.psm1:1068 : 13
+             Throw ("Failed to run: " + ($Command -Join " "))
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (Failed to run: ...11_Pro_23H2.raw:String) [], RuntimeException
    + FullyQualifiedErrorId : Failed to run: C:\Users\micka\windows-openstack-imaging-tools\bin\qemu-img.exe convert -O raw C:\Users\micka\windows-openstack-imaging-tools\Windows_11_Pro_23H2.vhdx C:\Users\micka\windows-openstack-imaging-tools\Windows_11_Pro_23H2.raw

Thanks for the help

reckful666 commented 9 months ago

When I try to execute the qemu-img convert command manually :

error while writing sector 0: Input/output error

ader1990 commented 9 months ago

Hello,

You should still have C:\Users\micka\windows-openstack-imaging-tools\Windows_11_Pro_23H2.vhdx. If you need to convert it to .raw file, make sure you have enough free space, as the raw image type needs its exact size free: Final disk size: 21.001953125 GB

reckful666 commented 9 months ago

Thank you very much, I will try to upload it to openstack and create instance with it.

reckful666 commented 9 months ago

It seems to work well ! But I can't connect to the instance, I don't find the good password for admin account. I tried the password in UnattendTemplate.xml file and config file.

ader1990 commented 9 months ago

Hello,

I think this blog post might give some clarity on how the password part works: https://cloudbase.it/openstack-windows-admin-password/

Thanks.

reckful666 commented 9 months ago

Thanks a lot again, the nova get-password works like a charm.