Monday, April 13, 2015

Making your Windows KVM guest boxes fly with VirtIO



In order to extract the maximum performance out of a Windows guest OS on KVM / qemu you should install VirtIO.

What is virtio?

There are quite a few articles about it but basically it is like the VMWare Tools for KVM. It is a bunch of libraries that basically speed up your guest OS by making it more efficient to communicate with the host.

What speed ups are we talking about? Mainly disk I/O and network. Without Virtio drivers installed your Windows guest will feel like molasses. Or more like the difference between traditional hard drives and SSDs. It will still work but you won't like it.

What tripped me up about install the drivers was that everywhere I looked it said to download them from the Fedora project here: http://alt.fedoraproject.org/pub/alt/virtio-win/stable/.

The problem is I was using Ubuntu so while you can install the drivers it just blue screens on you with a giant STOP error. Basically I was using the wrong drivers.

I am on Ubuntu 14.04 LTS so what I really wanted was this: https://launchpad.net/kvm-guest-drivers-windows/+download


The overall technique is setup a device that uses virtio in the libvirt configuration file for your guest. This is an xml configuration file you access by typing virsh and then "edit <name>".

After you do this you will want to specify a specific network card or disk that has type="virtio". This will cause Windows to detect a new type of device in Device Manager. You then update the driver by using the downloads found on launchpad.

If you are lucky you will see the following:


Both should say "packaged by Canonical". These are the major drivers you will want. The other is a serial driver and then a balloon driver. The balloon driver is for dynamic memory management.

If you are wondering why you don't need to install these drivers on Linux guests it is because linux guests have it compiled into the kernel by default.



5 comments:

dbp said...

For Debian 8 Host:

Older Redhat drivers (virtio-win-0.1.096) installed in Windows 2008 Guest crash sometimes; Balloon driver crash frequently.

Latest Redhat drivers (virtio-win-0.1.105) installed in Windows 2008 Guest provides excellent compatibility. Not installed balloon driver.

Unknown said...

Hi- Is the balloon and serial driver recommended for 2008 and 2012? It seems that it's available, but some say to use it and some say it's not needed. Thanks

Jeff Tchang said...

You don't have to install it but you may want to if you want to to dynamically change the memory on a box.

jribeauv said...

Hi,

I add the device in the .xml conf file using this way ( I suppress tag marker in this post) :

channel type='unix'
source mode='bind' path='//var/lib/libvirt/qemu/omnivision_1.agent'
target type='virtio' name='omnivision_1.agent' state='disconnected'
alias name='channel1'
address type='virtio-serial' controller='0' bus='0' port='2'/
/channel


After the guest has been rebooted, I see that the driver VirtIO-Serial Driver is now installed .

So far so good ....

Then, I tried to have a look within the registry but no additional key here :

HKLM\HARDWARE\DEVICEMAP\SERIALCOMM


Is it the right way to proceed ?
Or did I miss something ?

Thanks for help.

Regards,

J.P.

Unknown said...

Hi,
I installed KVM in ubuntu 14.04(host OS) and through virt-manager i installed windows 2008 server.
I am trying to replace RealTek network adaptor with virtio in my windows 2008 server, but i am getting error "This device is not working properly because Windows cannot load the drivers required for this device(Code 31)".
can u plese help..

Thanks in advance