How to Create Windows image for OpenStack

Updated on March 7, 2022

I was assigned a task to create Windows image for OpenStack unlike most Linux distros, it is not possible to download generic qcow2 images, we can’t find any for Windows images on the internet. This guide shall provide in detailed explanation for creating a Windows qcow2 image to be used on the OpenStack cloud. This article can be used to boot any of the Windows OS’s.


Before we get started, the following are needed:

Create Windows image for OpenStack

Configure VM for Windows using virt-manager GUI

Login to your CentOS Linux machine that has KVM installed using MobaXterm and execute virt-managerGUI command.

# virt-manager
X server ON in MobaXterm

Make sure X server is ON in MobaXterm for exporting X-Display from your CentOS Linux machine on to the Windows machine.

From the Virt-Manager windows, navigate to File -> New Virtual Machine

Virt-Manager - Create New Virtual Machine

Windows ISO & VirtIO ISO file on Server

Copy the Windows ISO and Virtio ISO files to the server’s /var/lib/libvirt/images directory.

Choose your Installation media

Virt-Manager - Create New Virtual Machine

Specify the PATH of the Windows ISO file and click Choose Volume button.

Virt-Manager - Select OS ISO file

Choose the operating system you are installing. Uncheck the radio button so as not to automatically detect the OS. Type your OS name and select the appropriate OS. For this article’s purpose, I’m installing Windows 10.

Virt-Manager - Select OS type

Allocate RAM and CPU

Virt-Manager - Choose CPU & RAM

Specify the size of the Virtual Hard Disk

Virt-Manager - Choose Disk Size

Choose a name for the VM, select the network type as Virtual Network: NAT, and select the radio button Customize Configuration before install.

Virt-Manager - Choose VM Name, Virtual Network

Upon finish, QEMU/KVM configuration window opens

QEMU/KVM - VM Configuration Settings

Navigate to SATA Disk 1 and choose VirtIO as Disk bus

QEMU/KVM - Virtual Hard Disk type

Navigate to NIC (Virtual Network Interface) and choose VirtIo for Device model

QEMU/KVM - Virtual Network type

VirtIO Device Drivers

To use the Virtual devices on your QEMU/KVM Windows VM, so as to install the VirtIO drivers at necessary times, you need to mount the VirtIO ISO onto a CDROM. Let’s add a new CDROM device and mount the VirtIO driver ISO file.

Click on Add Hardware. Under Storage, choose the device type as CDROM device and click manage and select Virtio iso file and click Finish button.

QEMU/KVM - Add additional CDROM

Windows Installation on KVM

We are good to go ahead with the Begin Installation and Windows Installer will appear. Click Next

Virt-Manager - Windows Installation

Click Install now

Virt-Manager - Windows Installation

Windows Setup – Click I don’t have a product key

Virt-Manager - Windows Installation License Key

Windows Setup – Select Windows 10 Home

KVM - Windows 10 Home

By default, Windows doesn’t discover the virtualized hard disk without drivers.

Click Load driver

KVM - Load Redhat VirtIO driver

Click Browse

KVM - Load Redhat VirtIO driver

Select amd64 > w10 (for windows 10) under the VirtIO CD drive mounted earlier.

KVM - Install Redhat VirtIO driver for Windows

Install the Red Hat VirtIO SCSI controller driver

KVM Install Redhat VirtIO SCSI Controller Driver

Once the Red Hat VirtIO SCSI controller driver is successfully installed, the Virtual Hard Disk shall be visible to install the Windows OS. Click Next.

KVM select Virtual Hard Disk for Windows Installation

Windows installer shall start installing Windows. It may take a while to complete the Windows installation and may reboot several times during the installation. You’ll be presented with a series of Windows Setup screens as below:

  • Select your country
  • Keyboard Layout type
  • Want to add a second keyboard layout? – Skip
  • Let’s connect you to a network – I don’t have internet
  • There’s more to discover when you connect to the internet – Continue with limited setup
  • Who’s going to use this PC?
    • Set the username and password and series of security questions
  • Choose privacy settings for your device
    • You can configure according to your needs
  • Let Cortana help you get things done – Not Now

Relax as Windows takes a while to prepare the system.

Install Red Hat VirtIO Drivers

After successful installation, you’ll be presented with a login screen

KVM Windows 10 Installation login screen

Navigate to VirtIO CDROM Drive inside VM.

KVM Windows install VirtIO drivers

Double click on virtio-win-guest-tools executable to install all the necessary drivers for the Windows OS to use Virtual Hardwares.

KVM Windows Virtio-win-guest-tools installer

After successful installation of the VirtIO drivers, your network will get activated and you are good to use the internet now.

Prepare the Windows guest OS for Cloud Use

Now that the guest OS is installed, we must configure the system for use in a Cloud environment. Cloudbase Solutions has developed Cloudbase-Init which is the Windows equivalent of the Cloud-Init project used on most OpenStack Linux images.

Download the Cloudbase-init and install it on the newly created Windows 10 VM instance. Leave the default options during Cloudbase-init installer and Install. Before the finish of the Cloudbase-init installer make sure you selected both the checkboxes.

Run Sysprep to create the generalized image: checked

Shutdown when Sysprep terminates:  checked

KVM Windows Virtio-win-guest-tools installer

Click Finish and Sysprep will run for a while and automatically shut down the system.

KVM Windows sysprep - Processing generalize phase sysprep plugins

Now the Windows 10 QCOW2 image at the location /var/lib/libvirt/images on the server is an OpenStack enabled Cloud Image.

However, when using Windows 10 QCOW2 image in OpenStack, had to wait for a long time for the image to boot up. This was because of an error in Windows unattend file configuration. Follow the article: How to fix Windows could not parse or process the unattend answer file for Pass Specialize to solve the issue and now the Windows 10 QCOW2 image is ready to be deployed in OpenStack Cloud.

Proceed further to create a Windows Image with Autologin configured so that the user need not manually provide the username and password for every bootup. Export the Windows 10 QCOW2 image to be deployed in OpenStack Cloud with has an Autologin feature enabled!

Was this article helpful?

Related Articles

Leave a Comment