Created: 2019-12-17Updated: 2019-12-17
Injecting KVM Drivers to Windows 10 for OpenStack

Table of Contents
Prepare the image in-guest
From VMWare or HyperV, launch your template Windows VM and log in as an administrative user. Make any firewall changes you need, install any packages, and ensure that RDP is enabled.
Remove VMWare Tools
If the guest has VMWare tools installed, remove them. They won't be needed where we're going.
Install cloudbase-init & sysprep (if needed)
This isn't so much for KVM as it is for OpenStack, but cloudbase-init is the Windows version of cloud-init. This will set your hostname and such when the VM is created.
- Download the Cloudbase-init installer
- Run through the installer.
- Don't run as Local System.
- Don't name your user Administrator, the named user is made by this service to run the startup tasks.
- At the end of the installation, you'll be prompted to sysprep. If this VM will be re-used as a template and not just a one-off VM, then sysprep it.
Shut down the VM & Export the drive
Shut down the VM and grab the VMDK or VHDX file it booted from. Copy that file
to a directory on your computer, such as C:\Temp.
Inject the KVM Drivers
- Download the VirtIO ISO
- Mount the ISO to your workstation. In these examples, it's E:
- Open PowerShell as admin and verify that the file is where you put it. You
can show some basic info about it like this:
get-vhd C:\Temp\Win10.vhdx - Create a mount-point for Dism:
mkdir C:\mount - Mount the volume with Dism:
Dism /mount-image /ImageFile:C:\Temp\Win10.vhdx /Index:1 /MountDir:C:\mount - Inject the
viostordriver:Dism /image:C:\mount /Add-Driver /Driver:E:\viostor\w10\amd64 /Recurse - Inject the
Baloondriver:Dism /image:C:\mount /Add-Driver /Driver:E:\Balloon\w10\amd64 /Recurse - Inject the
NetKVMdriver:Dism /image:C:\mount /Add-Driver /Driver:E:\NetKVM\w10\amd64 /Recurse - Confirm the drivers injected:
Dism /image:C:\mount /Get-Drivers - Unmount the image:
Dism /Unmount-image /MountDir:c:\mount /commit
Now the image is ready to be converted to raw/qcow2 and uploaded to OpenStack.
Note: CloudBase has released a Windows version of qemu-img so you can do
the conversions on Windows now without VirtualBox tools. You can download it
here
If you want to create a brand-new Windows VM on KVM from scratch rather than importing an existing image, see Create Windows KVM VM from Command Line.