12.3. Installing the Para-virtualized Drivers
Important
Note
MBR
and the boot loader (GRUB
), and for the /boot
partition. This partition can be very small, as it only needs to have enough capacity to hold the /boot
partition.
/
, /usr
) or logical volumes.
/boot
partition will use the virtualized block device drivers.
12.3.1. Common installation steps
- Copy the RPMs for your hardware architecture to a suitable location in your guest operating system. Your home directory is sufficient. If you do not know which RPM you require verify against the table at Section 12.2, “Para-virtualization Restrictions and Support”.
- Use the
rpm
command or theyum
command to install the packages. Therpm
utility will install the following four new kernel modules into/lib/modules/[%kversion][%kvariant]/extra/xenpv/%release
:- the PCI infrastructure module,
xen_platform_pci.ko
, - the ballooning module,
xen_balloon.ko
, - the virtual block device module,
xen_vbd.ko
, - and the virtual network device module,
xen_vnif.ko
.
- If the guest operating does not support automatically loading the para-virtualized drivers (for example, Red Hat Enterprise Linux 3) perform the required post-install steps to copy the drivers into the operating system specific locations.
- Shut down your guest operating system.
- Reconfigure the guest operating system's configuration file on the host to use the installed para-virtualized drivers.
- Remove the “type=ioemu” entry for the network device.
- Add any additional disk partitions, volumes or LUNs to the guest so that they can be accessed via the para-virtualized (
xen-vbd
) disk driver. - For each physical device, LUN, partition or volume you want to use the para-virtualized drivers you must edit the disk entry for that device in the libvirt configuration file.
- A typical disk entry resembles the following:
<disk type='file' device='disk'> <driver name='file'/> <source file='/dev/hda6'/> <target dev='hda'/> </disk>
Modify each disk entry, as desired, to use the para-virtualized by changing the driver elements as shown below.<disk type='file' device='disk'> <driver name='tap' type='aio'/> <source file='/dev/hda6'/> <target dev='xvda'/> </disk>
- Add any additional storage entities you want to use for the para-virtualized block device driver.
- Restart your guest:
# xm start YourGuestName
Where YourGuestName is the name of the configuration file or the guest operating system's name as defined in its configuration file in the name = "os_name" parameter. - Reconfigure the guest network.
12.3.2. Installation and Configuration of Para-virtualized Drivers on Red Hat Enterprise Linux 3
Note
The list below covers the steps to install a Red Hat Enterprise Linux 3 guest with para-virtualized drivers.
- Install the latest kernel version. The para-virtualized drivers require at least Red Hat Enterprise Linux 3.9 kernel version
kernel-2.4.21-60.EL
for all the required headers. - Copy the
kmod-xenpv
rpm for your hardware architecture and kernel variant to your guest operating system. - Use the
rpm
utility to install the RPM packages. Ensure you have correctly identified which package you need for your guest operating system variant and architecture.[root@rhel3]# rpm -ivh kmod-xenpv*
- Use the commands below load the para-virtualized driver modules. %kvariant is the kernel variant the para-virtualized drivers have been build against and %release corresponds to the release version of the para-virtualized drivers.
[root@rhel3]# mkdir -p /lib/modules/'uname -r'/extra/xenpv [root@rhel3]# cp -R /lib/modules/2.4.21-52.EL[%kvariant]/extra/xenpv/%release \ /lib/modules/'uname -r'/extra/xenpv [root@rhel3]# depmod -ae [root@rhel3]# modprobe xen-vbd [root@rhel3]# modprobe xen-vnif
Note
Warnings will be generated byinsmod
when installing the binary driver modules due to Red Hat Enterprise Linux 3 having MODVERSIONS enabled. These warnings can be ignored. - Verify
/etc/modules.conf
and make sure you have an alias foreth0
like the one below. If you are planning to configure multiple interfaces add an additional line for each interface.alias eth0 xen-vnif
Edit/etc/rc.local
and add the line:insmod /lib/modules/'uname -r'/extra/xenpv/%release/xen-vbd.o
Note
Substitute “%release” with the actual release version (for example 0.1-5.el) for the para-virtualized drivers. If you update the para-virtualized driver RPM package make sure you update the release version to the appropriate version. - Shutdown the virtual machine (use “
#shutdown -h now
” inside the guest). - Edit the guest configuration file in
/etc/xen/YourGuestName
with a text editor, performing the following changes:- Remove the “
type=ioemu
” entry from the “vif=
” entry. - Add any additional disk partitions, volumes or LUNs to the guest so that they can be accessed via the para-virtualized (
xen-vbd
) disk driver. - For each physical device, LUN, partition or volume you want to use the para-virtualized drivers you must edit the disk entry for that device in the libvirt configuration file.
- A typical disk entry resembles the following:
<disk type='file' device='disk'> <driver name='file'/> <source file='/dev/hda6'/> <target dev='hda'/> </disk>
Modify each disk entry, as desired, to use the para-virtualized by changing the driver elements as shown below.<disk type='file' device='disk'> <driver name='tap' type='aio'/> <source file='/dev/hda6'/> <target dev='xvda'/> </disk>
- Once complete, save the modified configuration file and restart the guest.
- Boot the virtual machine:
# xm start
YourGuestName
Where YourGuestName is the name of the configuration file or the guest operating system's name as defined in its configuration file in the name = "os_name" parameter.
Warning
weak-modules
and modversions
support is not provided in Red Hat Enterprise Linux 3. To insert the module execute the command below.
insmod xen_vbd.ko
xen-vbd
. The steps below will cover how to create and register para-virtualized block devices.
#!/bin/sh module="xvd" mode="664" major=`awk "\\$2==\"$module\" {print \\$1}" /proc/devices` # < mknod for as many or few partitions on xvd disk attached to FV guest > # change/add xvda to xvdb, xvbd, etc. for 2nd, 3rd, etc., disk added in # in xen config file, respectively. mknod /dev/xvdb b $major 16 mknod /dev/xvdb1 b $major 17 mknod /dev/xvdb2 b $major 18 chgrp disk /dev/xvd* chmod 0660 /dev/xvd*
# mknod /dev/xvdc b $major 16 # mknod /dev/xvdc1 b $major 17
# mknod /dev/xvdd b $major 32 # mknod /dev/xvdd1 b $major 33
[root@rhel3]# cat /proc/partitions major minor #blocks name 3 0 10485760 hda 3 1 104391 hda1 3 2 10377990 hda2 202 16 64000 xvdb 202 17 32000 xvdb1 202 18 32000 xvdb2 253 0 8257536 dm-0 253 1 2031616 dm-1
xvdb
” is available to the system.
- Create directories to mount the block device image in.
[root@rhel3]# mkdir /mnt/pvdisk_p1 [root@rhel3]# mkdir /mnt/pvdisk_p2
- Mount the devices to the new folders.
[root@rhel3]# mount /dev/xvdb1 /mnt/pvdisk_p1 [root@rhel3]# mount /dev/xvdb2 /mnt/pvdisk_p2
- Verify the devices are mounted correctly.
[root@rhel3]# df /mnt/pvdisk_p1 Filesystem 1K-blocks Used Available Use% Mounted on /dev/xvdb1 32000 15 31985 1% /mnt/pvdisk_p1
- Update the
/etc/fstab
file inside the guest to mount the devices during the boot sequence. Add the following lines:/dev/xvdb1 /mnt/pvdisk_p1 ext3 defaults 1 2 /dev/xvdb2 /mnt/pvdisk_p2 ext3 defaults 1 2
Note
dom0
), the "noapic
" parameter should be added to the kernel boot line in your virtual guest's /boot/grub/grub.conf
entry as seen below. Keep in mind your architecture and kernel version may be different.
kernel /vmlinuz-2.6.9-67.EL ro root=/dev/VolGroup00/rhel4_x86_64 rhgb noapic
Important
12.3.3. Installation and Configuration of Para-virtualized Drivers on Red Hat Enterprise Linux 4
Note
The list below covers the steps to install a Red Hat Enterprise Linux 4 guest with para-virtualized drivers.
- Copy the
kmod-xenpv
,modules-init-tools
andmodversions
RPMs for your hardware architecture and kernel variant to your guest operating system. - Use the
rpm
utility to install the RPM packages. Make sure you have correctly identified which package you need for your guest operating system variant and architecture. An updated module-init-tools is required for this package, it is available with the Red Hat Enterprise Linux 4-6-z kernel or newer.[root@rhel4]# rpm -ivh modversions [root@rhel4]# rpm -Uvh module-init-tools [root@rhel4]# rpm -ivh kmod-xenpv*
Note
There are different packages for UP, SMP, Hugemem and architectures so make sure you have the right RPMs for your kernel. - Execute
cat /etc/modprobe.conf
to verify you have an alias foreth0
like the one below. If you are planning to configure multiple interfaces add an additional line for each interface. If it does not look like the entry below change it.alias eth0 xen-vnif
- Shutdown the virtual machine (use “
#shutdown -h now
” inside the guest). - Edit the guest configuration file in
/etc/xen/YourGuestsName
in the following ways:- Remove the “
type=ioemu
” entry from the “vif=
” entry. - Add any additional disk partitions, volumes or LUNs to the guest so that they can be accessed via the para-virtualized (
xen-vbd
) disk driver. - For each additional physical device, LUN, partition or volume add an entry similar to the one shown below to the “
disk=
” section in the guest configuration file. The original “disk=
” entry might also look like the entry below.disk = [ "file:/var/lib/libvirt/images/rhel4_64_fv.dsk,hda,w"]
- Once you have added additional physical devices, LUNs, partitions or volumes; the para-virtualized driver entry in your XML configuration file should resemble the entry shown below.
disk = [ "file:/var/lib/libvirt/images/rhel3_64_fv.dsk,hda,w", "tap:aio:/var/lib/libvirt/images/UserStorage.dsk,xvda,w" ]
Note
Use “tap:aio
” for the para-virtualized device if a file-based image is used.
- Boot the virtual machine using the
virsh
command:# virsh start
YourGuestName
kudzu
will ask you to "Keep or Delete the Realtek Network device" and "Configure the xen-bridge device". You should configure the xen-bridge
and delete the Realtek network device.
Note
dom0
), the "noapic
" parameter should be added to the kernel boot line in your virtual guest's /boot/grub/grub.conf
entry as seen below. Keep in mind your architecture and kernel version may be different.
kernel /vmlinuz-2.6.9-67.EL ro root=/dev/VolGroup00/rhel4_x86_64 rhgb noapic
[root@rhel4]# cat /proc/partitions major minor #blocks name 3 0 10485760 hda 3 1 104391 hda1 3 2 10377990 hda2 202 0 64000 xvdb 202 1 32000 xvdb1 202 2 32000 xvdb2 253 0 8257536 dm-0 253 1 2031616 dm-1
xvdb
” is available to the system.
- Create directories to mount the block device image in.
[root@rhel4]# mkdir /mnt/pvdisk_p1 [root@rhel4]# mkdir /mnt/pvdisk_p2
- Mount the devices to the new folders.
[root@rhel4]# mount /dev/xvdb1 /mnt/pvdisk_p1 [root@rhel4]# mount /dev/xvdb2 /mnt/pvdisk_p2
- Verify the devices are mounted correctly.
[root@rhel4]# df /mnt/pvdisk_p1 Filesystem 1K-blocks Used Available Use% Mounted on /dev/xvdb1 32000 15 31985 1% /mnt/pvdisk_p1
- Update the
/etc/fstab
file inside the guest to mount the devices during the boot sequence. Add the following lines:/dev/xvdb1 /mnt/pvdisk_p1 ext3 defaults 1 2 /dev/xvdb2 /mnt/pvdisk_p2 ext3 defaults 1 2
Note
Important
Note
xen-vbd
driver may not automatically load. Execute the following command on the guest, substituting %release with the correct release version for the para-virtualized drivers.
# insmod /lib/modules/'uname -r'/weak-updates/xenpv/%release/xen_vbd.ko
12.3.4. Xen Para-virtualized Drivers on Red Hat Enterprise Linux 5
Note
Procedure 12.1. Enable para-virtualized drivers for a Red Hat Enterprise Linux Guest
- Shutdown the virtual machine (use “
#shutdown -h now
” inside the guest). - Edit the guest configuration file in
/etc/xen/<Your GuestsName>
in the following ways:- Remove the “
type=ioemu
” entry from the “vif=
” entry. - Add any additional disk partitions, volumes or LUNs to the guest so that they can be accessed via the para-virtualized (
xen-vbd
) disk driver. - For each additional physical device, LUN, partition or volume add an entry similar to the one shown below to the “
disk=
” section in the guest configuration file. The original “disk=
” entry might also look like the entry below.disk = [ "file:/var/lib/libvirt/images/rhel4_64_fv.dsk,hda,w"]
- Once you have added additional physical devices, LUNs, partitions or volumes; the para-virtualized driver entry in your XML configuration file should resemble the entry shown below.
disk = [ "file:/var/lib/libvirt/images/rhel3_64_fv.dsk,hda,w", "tap:aio:/var/lib/libvirt/images/UserStorage.dsk,xvda,w" ]
Note
Use “tap:aio
” for the para-virtualized device if a file-based image is used.
- Boot the virtual machine using the
virsh
command:# virsh start
YourGuestName
[root@rhel5]# ifconfig eth0
[root@rhel5]# cat /proc/partitions major minor #blocks name 3 0 10485760 hda 3 1 104391 hda1 3 2 10377990 hda2 202 0 64000 xvdb 202 1 32000 xvdb1 202 2 32000 xvdb2 253 0 8257536 dm-0 253 1 2031616 dm-1
xvdb
” is available to the system.
- Create directories to mount the block device image in.
[root@rhel5]# mkdir /mnt/pvdisk_p1 [root@rhel5]# mkdir /mnt/pvdisk_p2
- Mount the devices to the new folders.
[root@rhel5]# mount /dev/xvdb1 /mnt/pvdisk_p1 [root@rhel5]# mount /dev/xvdb2 /mnt/pvdisk_p2
- Verify the devices are mounted correctly.
[root@rhel5]# df /mnt/pvdisk_p1 Filesystem 1K-blocks Used Available Use% Mounted on /dev/xvdb1 32000 15 31985 1% /mnt/pvdisk_p1
- Update the
/etc/fstab
file inside the guest to mount the devices during the boot sequence. Add the following lines:/dev/xvdb1 /mnt/pvdisk_p1 ext3 defaults 1 2 /dev/xvdb2 /mnt/pvdisk_p2 ext3 defaults 1 2
Note
dom0
), the "noapic
" parameter should be added to the kernel boot line in your virtual guest's /boot/grub/grub.conf
entry as seen below. Keep in mind your architecture and kernel version may be different.
kernel /vmlinuz-2.6.9-67.EL ro root=/dev/VolGroup00/rhel4_x86_64 rhgb noapic
Sometimes, activating the para-virtualized drivers does not delete the old virtualized network interfaces. To remove these interfaces from guests use the following procedure.
- Add the following lines to the
/etc/modprobe.d/blacklist
file. Blacklist8139cp
and8139too
for the RealTek 8139 ande1000
for the virtualized Intel e1000 NIC.8139cp
8139too
e1000
- Remove the old network scripts from the
/etc/sysconfig/network-scripts
directory. - Reboot the guest. The default network interface should now use the para-virtualized drivers.
12.3.5. Xen Para-virtualized Drivers on Red Hat Enterprise Linux 6
xen_emul_unplug=never