VMWare to Xen Migration
This document assumes you want to convert a RHEL4u5
or higher VMware guest into a Xen para-virtualized
guest on a RHEL5 host
Prepare the machine for booting with Xen
- First portion here edits /etc/modprobe.conf
so that the next kernel install puts the proper
modules in the initrd. image so it sees things
like network adapters and block devices
The VMWare /etc/modprobe.conf contains:
alias eth0 pcnet32
alias scsi_hostadapter mptbase
alias scsi_hostadapter1 mptscsi
alias scsi_hostadapter2 mptfc
alias scsi_hostadapter3 mptspi
alias scsi_hostadapter4 mptsas
alias scsi_hostadapter5 mptscsih
Replace that with:
# cat /etc/modprobe.conf
alias eth0 xennet
alias scsi_hostadapter xenblk
The modprobe.conf changes above should make sure
that mkinitrd makes sure the xenblk driver is loaded
on bootup.
Next we need to tell it where to send the default console.
Change the console section of /etc/inittab to
reflect the following:
# Run gettys in standard runlevels
co:2345:respawn:/sbin/agetty xvc0 9600 vt100-nav
#1:2345:respawn:/sbin/mingetty tty1
#2:2345:respawn:/sbin/mingetty tty2
#3:2345:respawn:/sbin/mingetty tty3
#4:2345:respawn:/sbin/mingetty tty4
#5:2345:respawn:/sbin/mingetty tty5
#6:2345:respawn:/sbin/mingetty tty6
Now you need to add a xen enabled kernel (assuming you
have downloaded the kernel-xen from RHN or somewhere else)
# rpm -ivh kernel-xen
Once that is done, shutdown the virtual machine and
use the following commands to convert the vmdk file to a
flat vmdk file:
# vmware-vdiskmanager -r vmware_image.vmdk -t 0 temporary_image.vmdk
Move the ‘temporary_image.vmdk’ file to a Xen host and use
qemu_img to convert vmdk to a raw image file:
# qemu-img convert -f vmdk temporary_image.vmdk -O raw xen_compatible.img
You can either use an existing guest config file or create a new
one (both based on the example below)
Create or modify the config file for your RHEL4 Xen guest in /etc/xen.
If your fully virtualized system was a Xen guest too, you will want to
keep the vif MAC address and the UUID the same as before.
you need to add a bootloader liner and remove the kernel , device_model
lin es also modify the entries for
'disk-' (replace file: with tap:aio: change 'hda' device name to xvda)
'vif=' (remove the type-ioemu entry) etc
(below is a config file fr om a rhel4u5pv guest as a reference)
name = "rhel45_pv"
uuid = "84f53698-34b6-4732-a245-1d83a4015f97"
memory = 12288
vcpus = 8
bootloader = "/usr/bin/pygrub"
extra = "ro root=/dev/VolGroup00/LogVol00 rhgb quiet"
on_poweroff = "destroy"
on_reboot = "restart"
on_crash = "restart"
sdl = 0
vnc = 1
vncunused = 0
keymap = "en-us"
disk = [ "tap:aio:/var/lib/xen/images/rhel45_pv.dsk,xvda,w" ]
vif = [ 'mac=00:16:3e:4f:85:fd, bridge=xenbr0', ]
Start your Xen guest. Make sure to choose the right kernel in the pygrub
menu, because anything except the paravirtualized kernel will fail to boot.
# virsh start rhel4u5
Partager