How To Force virt-manager To Use kqemu On Fedora 10

Want to support HowtoForge? Become a subscriber!
 
Submitted by athmane (Contact Author) (Forums) on Thu, 2009-02-19 11:49. :: Fedora | Virtualization

How To Force virt-manager To Use kqemu On Fedora 10

Author: Athmane Madjoudj <athmanem [at] gmail [dot] com>

When you use virt-manager to create and manage virtual machines using QEMU as hypervisor you may notice a poor performance on a no virtualization capable processor; this is because by default libvirt (an opensource virtualization API for Xen, KVM, Qemu) ignores the kqemu module (qemu acceleration kernel module). This mini-howto tries to workaround this problem.

 

1 Install virt-manager and kqemu:

The easier way to install kqemu on Fedora 10 is to add rpm fusion repository.

# rpm -ivh http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm

After that you can install virt-manager and kqemu for your kernel.

# yum install kqemu virt-manager

 

2 The workaround:

Now, rename /usr/bin/qemu to /usr/bin/qemu-original.

# mv  /usr/bin/qemu /usr/bin/qemu-original

Create a new file /usr/bin/qemu with the content listed below.

# touch /usr/bin/qemu
# chmod +x /usr/bin/qemu

Listing of /usr/bin/qemu:

#!/usr/bin/env python
from sys import argv
from os import system, execv
from os.path import exists
    
original_file = "/usr/bin/qemu-original" if not exists('/dev/kqemu'): print "Cannot run kqemu - the device does not exist!" else: if '-no-kqemu' in argv: argv[argv.index('-no-kqemu')] = '-kernel-kqemu' execv(original_file, argv)

Now you can load the kqemu module and enjoy the speed!

# modprobe kqemu

To autoload the kqemu module at the system start:

# touch   /etc/sysconfig/modules/kqemu.modules
# chmod +x  /etc/sysconfig/modules/kqemu.modules

Listing of kqemu.modules:

#!/bin/sh
modprobe kqemu

Please do not use the comment function to ask for help! If you need help, please use our forum.
Comments will be published after administrator approval.