Tag Archives: Redhat viruatlization

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

KVM (Kernel Based Virtual Machine) – http://www.linux-kvm.org/ , 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
eg:
# 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

DEVICE=br0
ONBOOT=yes
TYPE=Bridge
IPADDR=11.11.11.11
NETMASK=255.0.0.0
GATEWAY=1.1.1.1

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

DEVICE=bond0
BRIDGE=br0
ONBOOT=yes

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

DEVICE=eth0
MASTER=bond0
SLAVE=yes
ONBOOT=yes

– 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.

./arun