IBM Support

How to create windows image(KVM) supports virtio

Question & Answer


Question

Customer always confuse about how to create a windows VM image that supports virtio. Since the information on the infocenter doesn't list the steps clearly.

Answer


Step1: Install the OS to image file.
1. create sparse raw image file
# qemu-img create -f raw win2k3.img 30G

2. download the lastest virtio driver for Windows from virtio official site

3. use virt-install to install windows OS into image file
# virt-install --connect=qemu:///system --name=mywin --os-type=windows \
-r 1024 --cpus=1 --os-variant=win2k3 --hvm –cdrom=/path/to/en_windows_2k3.iso \
--disk path=/path/to/win2k3.img --accelerate --network=bridge:br0 --vnc
After finished Windows installation, shutdown the virtual machine. And copy the virtio ISO file into the image:
i.Open a new VNC window and then run virt-manager.
ii.Double-click the domain name (VM). This might take a few minutes to complete.
iii.Click Details at the top.
iv.Click IDE CDROM 1 on the left.
v.Click Disconnect on the right and then click Connect.
vi.Locate the virtio-win-0.1.22.iso downloaded before by clicking Browse > Browse Local > File System > Corresponding Directory and then locate this ISO image file from the local.
vii.Click OK to connect to it.
viii.Return to Installation Windows, or click Console at the top to continue the installation.
ix.Create a new folder on the Windows machine, for example, C:\virtio, and then open the floppy device where you can see the files of the ISO image.
x.Copy all folders and files from the floppy to the new folder you created in the previous step.
xi. Shutoff VM.
xii. Repeat steps iii and iv above, then disconnect and remove the device to which the ISO image file is connected.

4. create a small virtual disk, and attach to the virtual machine as a virtio disk in virt-manager:
qemu-img create -f raw tempdisk.img 10M
Open the virtual machine in virt-manager, and add a hardware. In the popup window, select the above virtual disk, and select Virtio Disk as device type, none as cache mode, raw as storage format. Then press Finish button.

5. Power on the virtual machine. Windows will find the new hardware (disk), please follow the wizard and select proper driver. The below is the content description of virtio-win-0.1-22.iso:
wxp: disk driver for Windows XP
wnet: disk driver for Windows 2003
wlh: disk driver for Windows 2008
xp: network driver for Windows XP/2003
vista: network driver for Windows Vista/7/2008
After installed the virtio disk driver, shutdown the virtual machine.

6. Open the virtual machine in virt-manager, and remove the two virtual disks (the root one, and the temporary small one), and add the root image again but select Virtio Disk as device type in the wizard. Remove the network card, and add a new network card but select virtio as device model. Power on the virtual machine again, and follow the wizard to finish drivers installation.
Take updating the ethernet driver as an example.
i.right click "My Computer"-->Manage-->Device Manager-->Other Devices(marked as yellow "?")
ii.right click Ethernet Controller(marked as yellow "!")-->Update driver (it will become "Red Hat Virtio Ethernet Adapter" when done)

After the above steps finished, you have enabled the virtio to the image, then go on with the left steps on the infocenter from step 3. You can reach the step 3 through this link http://publib.boulder.ibm.com/infocenter/tivihelp/v48r1/index.jsp?topic=%2Fcom.ibm.hslt.doc_1.1.2%2Fadministering%2Ft_create_images_win.html.

[{"Product":{"code":"SSZH3R","label":"IBM Service Agility Accelerator for Cloud"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Virtual Machine","Platform":[{"code":"PF016","label":"Linux"}],"Version":"1.2","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

Modified date:
17 June 2018

UID

swg21587905