Linux Virtualization

Performance issues with KVM – Redhat

The general performance issue with KVM is due to DISK I/O

– by default the Redhat KVM guest are created with x86_64 architecuture, if you installed 32 bit operating system change this to i686.

<type arch=’i686′ machine=’rhel5.6.0′>hvm</type>
<boot dev=’hd’/>

– Make sure the hypervisor used is correct in the configuration , either qemu or kvm

<domain type=’kvm’>


<domain type=’kvm’>

РUse virtio drivers if the guest is paravirtulized ( ,


Linux Virtualization

Converting LVM virtual machine storage to image

To convert the LVM disk to qcow2 formatted disk image,

Use lvdisplay to get the Logical volume name

$ sudo lvdisplay

Use qemu-img to convert to the required image format

# qemu-img convert -O qcow2 /dev/mapper/lv_name <destination_file>.qcow2


# qemu-img convert -O qcow2 /dev/mapper/disk1 disk1.qcow2

This will be useful to replicate the virtual machines to other hardware.


Linux Virtualization

Netboot KVM guest

To install the KVM guest operating system (eg: RHEL) from the network
– Create the bridge interface on the KVM host machine (
– Make sure that the gateway is configured in the bridge interface (GATEWAY=).
– Make sure that you have the required rules added to the iptables:
-A FORWARD -m physdev --physdev-is-bridged -j ACCEPT
– Create virtual machine with supported network interface type (pcnet, rtl8139 used to work)
– Add the mac address of kvm guest to the dhcp server

Start the virtual machine and see if it can kick start from the network.

You can trouble shoot with a tcpdump on the KVM host machine:
tcpdump -i br0 port bootps -vvv -s 1500


Linux Virtualization

Virtualization with KVM under Redhat Linux, Migrate VMware virtual images to KVM

KVM (Kernel Based Virtual Machine) – , is one of the best choice to do virtualization under linux, and especially without extra licensing cost.

Install KVM
To install KVM on redhat enterprise linux:
– Install the machine with 64 bit version of EL5
– Register the machine with redhat (rhn_register)
– enable virtualization entitlement for the system in RHN
– Install KVM package:
# yum install kvm
# yum install virt-manager libvirt libvirt-python python-virtinst

Migration VMware virtual machines to KVM:
– Login to the vmware server
– make single vmdk image with vmware-diskmanager
# vmware-vdiskmanager -r path_to_vmware_virtualmachine.vmdk -t 0 destination_file_vmware.vmdk
Creating disk ‘destination_file_vmware.vmdk’
Convert: 100% done.
Virtual disk conversion successful.

– Copy the image to KVM server
– Convert the image to KVM supported format with qemu-img
# qemu-img convert destination_file_vmware.vmdk -O qcow2 kvm_supported.img

Create bridge interface to to share the network card.
* This section assumes that you have two nic in your server and would need to have bonding along with bridging and you have static ip required for virtual machines. incase you using dhcp and single network interface create the bridge interface accordingly.

– Create bridge interface:
$ cat /etc/sysconfig/network-scripts/ifcfg-br0


– Configure the bond interface:
$ cat /etc/sysconfig/network-scripts/ifcfg-bond0


– Configure eth0 and eth1
$ cat /etc/sysconfig/network-scripts/ifcfg-eth0


– Change bonding to active-backup , i have faced some issues with xor – might be silly to fix
# cat /etc/modprobe.conf

options bond0 miimon=100 mode=active-backup

– Restart network interface and check the bridge status
# brctl show , it will show bond0 as an enabled interface.

Create KVM virtual machine:
– it can be done from the command line or with virt-manager
– open virt-manager application
– click create new, and select qemu hypervisor
– during disk selection, choose the converted vmware image path
– done, just start it.

Register the virtual machine with Redhat, save some license ;)

– enabled network tools entitlement in RHN
– install the package rhn-virtualization-host on the core machine
# yum install rhn-virtualization-host
– enable virtualization under the properties of host in RHN
– execute the following commands on host machine
# rhn_check
# rhn-profile-sync
– login to virtual machine and use rhn_register, now it will be registered as a virtual machine under the core license.